Perfect numbers

A number is perfect when its divisors, leaving out the number itself, add up to exactly that number: 6 = 1 + 2 + 3, and 28 = 1 + 2 + 4 + 7 + 14. Only 52 are known, and each one comes from a prime of the form 2p − 1. Are there infinitely many? Is there an odd one? Nobody knows.

Add up the divisors

14 + 7 + 4 + 2 + 1 = 28

Any whole number up to 999,999,999,999. Seven of them are perfect.

28 is perfect: its divisors add up to exactly 28.

The Mersenne prime hunt

Each prime of the form 2p − 1, a Mersenne prime, makes a perfect number: 2p − 1 × (2p − 1). Your browser tries every prime p in turn. 22 − 1 = 3 is plainly prime; for odd p it runs the Lucas–Lehmer test: start at 4, then square and subtract 2, p − 2 times, keeping only the remainder after dividing by 2p − 1. It ends at 0 exactly when 2p − 1 is prime.

It starts at p = 2 and keeps going until you stop it. The first ones come fast.

The record, the 52nd known, is 2to the power 136,279,841 − 1, with 41,024,320 digits.

Two thousand years of hunting

Around 300 BCE, Euclid showed that whenever 2p − 1 is prime, 2p − 1 × (2p − 1) is perfect. So 2 × 3 = 6, 4 × 7 = 28 and 16 × 31 = 496. About 2,000 years later, Euler proved that every even perfect number is made this way. Written in binary, that's p ones and then p − 1 zeros: 28 is 11100.

The primes are named after Marin Mersenne, who in 1644 listed the exponents up to 257 he believed worked. He included two that don't, 67 and 257, and left out three that do: 61, 89 and 107. Only a prime p can work, and not every prime does: 211 − 1 = 2,047 = 23 × 89.

Édouard Lucas proved 2127 − 1 prime in 1876, and it stayed the largest known prime for 75 years. Derrick Lehmer proved Lucas's method in full in 1930, and it's the test your browser runs. In January 1952 it ran on the SWAC computer at UCLA and found 2521 − 1, the first Mersenne prime found by an electronic computer, then 2607 − 1 less than two hours later.

Every one found since late 1996 has come from GIMPS, the Great Internet Mersenne Prime Search, run on volunteers' computers. The record, 2136,279,841 − 1, has 41,024,320 digits: Luke Durant found it in October 2024 with thousands of cloud GPUs, and a Lucas–Lehmer test confirmed it. Not every exponent below it has been checked yet, so there could be another hiding beneath it.

Nobody knows whether there are infinitely many Mersenne primes, so nobody knows whether there are infinitely many perfect numbers. Nobody has found an odd perfect number either, or proved there isn't one. If there is, it's bigger than 101500 (Ochem and Rao, 2012).