Formula for primes

From testwiki
Jump to navigation Jump to search

Template:Tone

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

1+i=12n(nj=1i(cosπ(j1)!+jj)2)1n

Proof

Let's first start with the (j1)!+1j.

Wilson's theorem says if (j1)!+1 is divisible by j, than j is either a prime number or 1, meaning when j is prime, (j1)!+1j 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 (cosπ(j1)!+jj)2 part.


The reason the formula has π multiplied by the (j1)!+1j part is because when (j1)!+1j is an integer, cos((j1)!+1jπ) will give 1 or 1.

When squaring the result then cos((j1)!+1jπ) will equal 1 when (j1)!+1j is an integer.

By flooring this, the only results are 1 when (j1)!+1j is an integer and 0 when it isn't, leaving(cosπ(j1)!+jj)2.


The j=1i(cosπ(j1)!+jj)2 will add 1s for the primes 1 - i and and will sum up to the (#primesi)+1.

The (nj=1i(cosπ(j1)!+jj)2)1n in short will give 1 if n>(#primesi) and 0 when n(#primesi).


Take the p(x) of both sides where p(x) is the nth prime number:

1 when nth prime>i i<nth prime

0 when nth primei inth prime


i=12n(nj=1i(cosπ(j1)!+jj)2)1n gives the number 1, and the 1 is because when i<nth prime reaches i=nth prime, the function doesn't add 1. The formula adds up to 2n is because Bertrand's postulate says 2n is bigger than the nth prime number.


And finally, 1 is added because of the 1.[1]

References

Template:Reflist