Willans' formula is a prime-generating formula due to Willan (1964) that is defined as follows. Let
(1)
(2)
for
an integer, where
is the floor function. This formula is a consequence
of Wilson's theorem and conceals the prime numbers
as those for which , i.e., the values of are 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, ... (OEIS A080339).
Then
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 th Prime Number." Math. Gaz.48, 413-415,
1964.