Mersenne primes
Published · By NumberWiki
Category Concepts
A Mersenne prime is a prime number one less than a power of two: 2p − 1. They are vanishingly rare — only 52 are known — yet they hold a near-monopoly on the title of "largest known prime," they generate the perfect numbers, and they power one of the longest-running volunteer computing projects on the internet.
The form, and why the exponent must be prime
Write the candidate as Mp = 2p − 1. In binary, that's
a string of p ones: 7 is 111,
31 is 11111, 127 is
1111111 — Mersenne numbers are the binary
repunits.
If the exponent is composite, the number always factors: whenever a divides b, 2a − 1 divides 2b − 1 (the same algebra that makes a decimal repunit divisible by smaller repunits). So 24 − 1 = 15 = 3 × 5 is doomed from the start. A prime exponent is therefore necessary — but not sufficient, and that gap is where the story gets interesting: 211 − 1 = 2047 = 23 × 89. Prime exponent, composite result.
The known sequence starts: M2 = 3, M3 = 7, M5 = 31, M7 = 127, M13 = 8191, M17 = 131,071, M19 = 524,287, then a jump to M31 = 2,147,483,647 — which doubles as the maximum value of a signed 32-bit integer, making it surely the Mersenne prime most often encountered by accident.
The monk who guessed
Marin Mersenne (1588–1648) was a French Minim friar who functioned as the scientific internet of his century — he corresponded with Descartes, Fermat, Pascal, and Galileo, relaying results across Europe when journals didn't yet exist. In 1644 he published a bold claim: 2p − 1 is prime for p = 2, 3, 5, 7, 13, 17, 19, 31, 67, 127, 257 and composite for all other p below 257.
The list was wrong in five places — 67 and 257 don't work; 61, 89, and 107 do — but checking it took the world nearly three hundred years. The most theatrical correction came in 1903, when Frank Nelson Cole gave an American Mathematical Society talk consisting, in its entirety, of silently computing 267 − 1 on one blackboard, multiplying 193,707,721 × 761,838,257,287 on another, and sitting down to a standing ovation. He later said finding the factors had taken "three years of Sundays." The name stuck to the numbers anyway — a fitting monument to the era when a good conjecture could outlive its errors.
The Lucas–Lehmer test: why Mersennes hold every record
The reason the largest known prime is almost always a Mersenne prime is not that they're common — it's that they're uniquely testable. The Lucas–Lehmer test (Édouard Lucas 1876, refined by Derrick Lehmer in 1930) decides the primality of Mp with a single dead-simple iteration: start with s = 4 and repeat s ← s² − 2 (mod Mp) exactly p − 2 times. The number is prime if and only if the result is 0. No factoring, no randomness, no uncertainty.
Using it, Lucas certified M127 = 170,141,183,460,469,231,731,687,303,715,884,105,727 by hand in 1876 — a 39-digit prime that remained the record for 75 years and is still the largest ever found without a computer. When electronic computers arrived, the test was the perfect workload: in 1952 Raphael Robinson's program on SWAC found five new Mersenne primes in a single year, more than the previous two centuries combined.
GIMPS and the modern hunt
Since 1996 the search has belonged to the Great Internet Mersenne Prime Search, one of the earliest volunteer distributed-computing projects. Every record prime since then is a GIMPS discovery, found on hardware ranging from office PCs to, most recently, cloud GPU fleets. The current record, found in October 2024, is 2136,279,841 − 1 — 41,024,320 digits — discovered by a former NVIDIA engineer running the first GPU-era GIMPS client. The Electronic Frontier Foundation's standing prize for a 100-million-digit prime is still unclaimed.
Are there infinitely many Mersenne primes? Conjectured yes — heuristics by Lenstra, Pomerance, and Wagstaff even predict how many to expect per order of magnitude — but nothing is proven. They thin out fast: only 52 in the first 136 million exponents.
Where they touch the rest of mathematics
- Perfect numbers — by the Euclid–Euler theorem, each Mersenne prime 2p − 1 produces the even perfect number 2p−1(2p − 1), and all even perfect numbers arise this way. The two hunts are one. See the perfect numbers article.
-
Computing — Mersenne numbers are all-ones bit patterns,
so they appear as masks and as the maxima of unsigned types;
M31 = 2,147,483,647 is
int.MaxValuein most languages, and M61 features in fast modular hashing. The Mersenne Twister, the most widely deployed random number generator of the last 30 years, takes its period 219937 − 1 from a Mersenne prime. - Group theory — for a 2p-element cyclic structure to behave well, Mp divisibility properties decide several classification questions; Mersenne primes also index a family of simple groups via PSL(2, Mp).
Mersenne primes on NumberWiki
Every number page checks Mersenne primality structurally (is n + 1 a power of two with prime exponent, and is n itself prime). Members are tagged Mersenne prime — all of 3, 7, 31, 127, 8191, 131071, 524287, and 2147483647 are in the permanent index. Related families: repunits (the base-10 analogue), powers of two (always one greater), and perfect numbers (the Euclid–Euler partners).
Further reading
- Chris Caldwell's Prime Pages (t5k.org) — the standard reference for Mersenne history and records.
- GIMPS (mersenne.org) — the search itself; status of every exponent ever tested.
- Paulo Ribenboim, The Little Book of Bigger Primes (Springer, 2nd ed. 2004) — chapter on Mersenne numbers and the Lucas–Lehmer test.
- The On-Line Encyclopedia of Integer Sequences, sequence A000668 — the Mersenne primes.
See also
- Perfect numbers — each Mersenne prime makes one.
- Prime numbers — the general theory.
- All Mersenne primes on NumberWiki →
- 2,147,483,647 — the Mersenne prime in every 32-bit integer overflow bug.