Mersenne primes

Mersenne primes are very intriguing. According to Mersenne a monk and mathematician all primes in the form
of 2p  -1 where p prime as well, must be prime. We see this is true and not true for:

p=2 : 22  -1 = 3 which is prime.
p=3 : 23  -1 = 7 which is prime.
p=5 : 25  -1 = 31 which is prime.
p=7 : 27  -1 = 127 which is prime.
p=11 : 211  -1 = 2047 which is not prime. (Monks must be lazy !!)
p=13 : 213  -1 = 8191 which is prime.
p=17 : 217  -1 = 131071 which is prime.
p=19 : 219  -1 = 524287 which is prime.
p= 23 : 223  -1 = 8388607 which is not prime.
p=29 : 229  -1 = 536870911 which is not prime.
p=31 : 231  -1 = 2147483647 which is prime. And so on.

We see that not all of them are prime. Fact is that it is very easy to prove that
if p not prime that these numbers are composite. If however p prime it is not to say they are prime.
Some however are prime and these we call Mersenne primes if in the form 2p  -1.
We also see that these numbers grow very quickly with increasing p.

So how do we test them for prime ness. In come Lucas and Lehmer with their very easy test.

Let S0 = 4  then Sn+1  = Sn2 - 2  mod Mp where Mp = 2p  -1 with p prime. If Sp-2 = 0 then Mp is prime.

As example lets take p = 7, so Mp = 2p  -1 = 27  -1 = 127

So S0 == 4
S1 = S0 2 - 2 =  16 -2 = 14 mod  127 = 14
S2 = S1 2 - 2 =  196 -2 = 194 mod 127 = 67
S3 = S2 2 - 2 =  4489 -2 = 4487 mod 127 = 42
S4 = S3 2 - 2 =  1764 -2 = 1762 mod 127 = 111 == -16
S5 = S4 2 - 2 =  256 -2 = 254 mod 127 = 0 , So M7 = 127 is prime
We see that we arrive at the answer in 5 steps. Sort of 2 steps less than the exponent value of  Mp = 2p  -1
This test is therefore quite fast if p big.

Currently (2007) there are only 44 Mersenne primes  known. The biggest prime of this sort founded so far is
Mp = 232 582 657 - 1  . If you find such a prime, you will be famous and may also win some big money if it has more than 10 million digits.
This prime has 9 808 358 digits.


Back to Main Page