Formula for primes

Willan's Formula is a formula that can find the nth prime number.

 Proof 
Let's first start with the .

Wilson's theorem says if  is divisible by , than  is either a prime number or , meaning when  is prime,  is an integer.

It would be much easier if the formula gives a number instead of checking if the number is an integer, and we can do this with the  part.

The reason the formula has  multiplied by the  part is because when  is an integer,  will give  or . 

When squaring the result then  will equal  when  is an integer.

By flooring this, the only results are  when  is an integer and  when it isn't, leaving.

The  will add s for the primes  -  and will sum up to the .

The  in short will give  if   and  when .

Take the  of both sides where  is the nth prime number:

 when    

 when    

 gives the number , and the  is because when   reaches  , the function doesn't add 1. The formula adds up to  is because Bertrand's postulate says  is bigger than the nth prime number.

And finally,  is added because of the .

 References 

Category:Prime numbers