The nucleic acid distribution function: Evaluation of the loop closure probability