Probability algorithm for prime test - c# implementation