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
| 
 
(3)
 
 | 
and
| 
 
(4)
 
 | |||
| 
 
(5)
 
 | 
where 
 is the prime counting function (Willans
 1964; Havil 2003, pp. 168-169).