Thursday 21 November 2013

Prime generating formulas?

I wrote about Wilson's theorem previously.  While Wilson's theorem can be used to test whether a positive integer is prime, there are no known formulas generating prime numbers.  Throughout the ages, mathematicians have been searching for such a formula, yet without success.  In addition to the Mersenne primes, there are other numbers studied by Fermat and Euler.

The Fermat numbers are generated by the formula, for n = 0, 1, 2, ...


The first five Fermat numbers 3, 5, 17, 257 and 65537 are all prime.  However, when n = 5,

F5 = 232 + 1 = 4294967297 = 641 × 6700417

is composite.

Euler saw that the formula n2 − n + 41 generates primes for n = 1, 2, 3, ... , 40.  Clearly, the formula fails to generate a prime when n = 41.