Kenneth Rosen, Elementary Number Theory; Addison Wesley
The concept of a Mersenne Prime is evolved from that of a perfect number. A perfect number is an integer for which the sum of its divisors is twice the number. For example:
(6) = 1 + 2 + 3 + 6 = 12 = 2*6 thus 6 is a perfect number.
The greeks discovered that all perfect numbers were of the form:
n = 2^(m-1) * (2^m - 1) where m >= 2 and (2^m - 1) is prime.It can be proven that if m is a positive integer and 2^m - 1 is prime, that m must be prime. This means that the quest for perfect numbers is reduced to the quest for primes of the form:
2^m - 1A Mersenne Prime is such a number Mp, where p is prime.
A Mersenne Number is a number Mm which may or may not be prime.
There are additional theorems which can be used to determine properties of Mersenne Numbers. One states:
If p is an odd prime, then any divisor of the Mersenne number Mp = 2^p - 1 is of the form 2kp + 1 where k is a positive integer.This leads instantly to a method of testing the primality of Mp. We know that any prime factors must be less than the square root, and we know from above that they must be of the form 2kp + 1. This is likely the method used by Mersenne to determine the primality of the Mersenne numbers for m < 257.
Let p be a prime and Mp = 2p - 1 the pth Mersenne number. Then define a recursive sequence by setting R1 = 4, and k >= 4,
Rk = (Rk-1)^2 - 2 (mod Mp), for 0 <= Rk < Mp.Then Mp is prime if and only if Rp-1 = 0 (mod Mp).
In pseudo code,
R = 4; for (i = 2; i > p; i++) { R = R*R; R -= 2; R = R mod Mp } if (R == 0) Mp is primeIn practice this is limited by the O(N^2) cost of multiplication. The technique used to evade this cost is to use FFTs to do your multiplication for you. I still don't really understand how that works.
List the numbers here