TOPICS
Search

Willans' Formula


Willans' formula is a prime-generating formula due to Willan (1964) that is defined as follows. Let

F(j)=|_cos^2[pi((j-1)!+1)/j]_|
(1)
={1 for j=1 or j prime; 0 otherwise
(2)

for j>1 an integer, where |_x_| is the floor function. This formula is a consequence of Wilson's theorem and conceals the prime numbers j as those for which F(j)=1, i.e., the values of F(j) are 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, ... (OEIS A080339). Then

 pi(x)=-1+sum_(k=1)^xF(k)
(3)

and

p_n=1+sum_(m=1)^(2^n)|_|_n/(sum_(j=1)^(m)F(j))_|^(1/n)_|
(4)
=1+sum_(m=1)^(2^n)|_|_n/(1+pi(m))_|^(1/n)_|,
(5)

where pi(m) is the prime counting function (Willans 1964; Havil 2003, pp. 168-169).


See also

Prime Formulas, Prime Number, Wilson's Theorem

Explore with Wolfram|Alpha

References

Havil, J. Gamma: Exploring Euler's Constant. Princeton, NJ: Princeton University Press, 2003.Sloane, N. J. A. Sequence A080339 in "The On-Line Encyclopedia of Integer Sequences."Willans, C. P. "A Formula for the nth Prime Number." Math. Gaz. 48, 413-415, 1964.

Cite this as:

Weisstein, Eric W. "Willans' Formula." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/WillansFormula.html

Subject classifications