Perfect Numbers

Add up all the divisors of 6 except 6 itself: 1 + 2 + 3 = 6. The number reappears, exactly, out of its own pieces. It looks like a coincidence — the kind of thing that shouldn't keep happening — and yet a handful of other numbers do the very same trick: 28 = 1+2+4+7+14, 496, 8128, and then they get scarce fast.

The ancient Greeks found this so striking they gave these numbers a name that still sounds like praise: perfect numbers. Euclid catalogued the first few in Book IX of the Elements around 300 BCE, and roughly four centuries later the philosopher Nicomachus of Gerasa devoted a whole passage of his Introduction to Arithmetic to them, comparing them — approvingly — to the rarest and most balanced things in nature. Over two thousand years of searching since then, mathematicians have found only a few dozen perfect numbers in total (every one past the first handful is monstrously large), and one very simple question about them — is there an odd one? — is still completely unanswered today. A two-line definition, and it has outlasted every civilisation that has tried to settle it.

Definition

A positive integer n is perfect if its proper divisors — all divisors except n itself — sum to exactly n. Using the divisor-sum function \sigma, which includes n in its own total, this becomes a one-line condition:

\sigma(n) = 2n.

(Add n to both sides of "proper divisors sum to n" and you get "all divisors sum to 2n" — the same statement, just measured with or without n itself in the pile.) Numbers with \sigma(n) < 2n are deficient; with \sigma(n) > 2n, abundant. Perfect numbers sit on the razor's edge between the two, and — as far as anyone has ever found — that edge is almost empty.

Perfection isn't the only pleasing pattern people have found among divisor sums, either. A pair of numbers where each one's proper divisors sum to the other one is called amicable — the smallest pair is 220 and 284. Think of a perfect number as an amicable "pair" with itself: it's its own perfect partner.

Worked examples: checking perfection

Example 1: n = 6.

Proper divisors: 1, 2, 3. Sum: 1+2+3 = 6 — matches n, so 6 is perfect. Equivalently, all divisors (including 6 itself) are 1,2,3,6, summing to \sigma(6) = 12 = 2 \cdot 6. ✓

Example 2: n = 28.

Proper divisors: 1, 2, 4, 7, 14. Sum: 1+2+4+7+14 = 28 — matches again. All divisors 1,2,4,7,14,28 sum to \sigma(28) = 56 = 2 \cdot 28. ✓

Example 3: a shortcut for n = 496.

Listing all the divisors of 496 by hand is tedious — but there's a pattern hiding in the first two examples worth noticing before we state it properly: 6 = 2 \times 3 and 28 = 4 \times 7, where each second factor (3, then 7) is one less than a power of 2, and is itself prime. Keep that pattern in mind — the next section turns it into a theorem, and confirms 496 = 16 \times 31 is perfect for exactly the same reason (16 = 2^4 and 31 = 2^5 - 1, a prime). The fourth perfect number, 8128 = 64 \times 127, follows the identical pattern one step further along: 64 = 2^6 and 127 = 2^7 - 1, again prime.

The Euclid–Euler theorem

Euclid spotted the pattern from the worked examples over 2000 years ago: perfect numbers seem to be forged from Mersenne primes — primes of the special form 2^p - 1. He proved that any number of that forged shape is perfect. It took until the 18th century — nearly two thousand years later — for Euler to prove the converse: that shape is not just a way to build an even perfect number, it is the only way.

An even positive integer n is perfect if and only if it has the form

n = 2^{p-1}\left(2^{p} - 1\right), \qquad \text{where } 2^{p} - 1 \text{ is prime.}

Check it against the examples: p=2 gives 2^1(2^2-1) = 2 \cdot 3 = 6; p=3 gives 2^2(2^3-1) = 4 \cdot 7 = 28; p=5 gives 2^4(2^5-1) = 16 \cdot 31 = 496. Every time 2^p-1 happens to be prime, the theorem hands you exactly one new even perfect number — and, by Euler's half, guarantees there are no other even ones hiding anywhere else.

This is also why the hunt for perfect numbers and the hunt for Mersenne primes are, in truth, the very same hunt. As of this writing only a few dozen Mersenne primes are known — found using massive distributed computing projects that have been running continuously for decades — and each new one instantly hands over exactly one new (even) perfect number, via the same short formula Euclid wrote down. Nobody knows if the supply of Mersenne primes ever runs out; if it doesn't, neither does the supply of even perfect numbers.

Watching the factory run

The theorem is really an assembly instruction: take a Mersenne prime, multiply it by the right power of 2, and a perfect number falls out. The bar below shows the two pieces side by side — the power-of-two piece in one colour, the Mersenne-prime piece in the other — for each of the first few values of p that actually produce a Mersenne prime. The bar's length is drawn on a fixed step-per-factor scale rather than to true size — if it were drawn to true scale, the bar for p=13 would need to be millions of times longer than the bar for p=2, which would make the picture useless. The actual computed value is always printed above, in full.

Notice how fast the results grow: p = 13 alone already produces 33{,}550{,}336 — over a hundred thousand times bigger than p=7's modest 8128. Mersenne primes get rarer as p grows, and every gap in p (like p=4,6,8,9,10,11,12, none of which make 2^p-1 prime) is a gap in the perfect numbers too — which is exactly why they thin out so quickly.

The Euclid–Euler theorem is airtight — but read it carefully: it characterises even perfect numbers only. It says nothing at all about whether an odd perfect number could exist, because its entire proof leans on n being even from the very first step.

It is tempting to think "perfect numbers = Euclid–Euler numbers," full stop. That's not proven. No one has ever found an odd perfect number, and searches have ruled them out below truly enormous bounds (past 10^{1500} at the time of writing) — but "hasn't been found" is not the same as "cannot exist." Whether an odd perfect number exists at all is one of the oldest open problems in mathematics, unresolved since antiquity. If you ever see a claim that "all perfect numbers have the form 2^{p-1}(2^p-1)" without the word "even" attached, that claim is overreaching what has actually been proved.

Mathematicians haven't found a proof, but they have found plenty of restrictions a hypothetical odd perfect number would be forced to satisfy — it would need an enormous number of distinct prime factors, at least one huge prime factor, and so on. None of these constraints rules odd perfect numbers out completely; they just make the search space narrower and narrower, like slowly closing a trap that has never quite sprung shut.

Long before Euclid's theorem explained why perfect numbers behave the way they do, Nicomachus turned the three-way split into deficient, abundant, and perfect numbers into a little moral fable. Deficient numbers, he wrote, were like an animal born with too few limbs — stunted, incomplete. Abundant numbers were like a many-headed monster — grotesque with excess. Perfect numbers, rare and exactly balanced, were held up as an image of virtue itself: nothing missing, nothing to spare.

Ancient numerologists couldn't resist the coincidence that the first two perfect numbers, 6 and 28, matched two very significant cycles: the Genesis creation story counts 6 days of work, and the Moon takes roughly 28 days to circle the Earth. Early Christian theologians ran with it — St. Augustine, writing in The City of God around 420 CE, argued that God didn't take six days to create the world because six was a convenient number, but because 6 is itself perfect: "six is a perfect number in itself, and not because God created all things in six days; rather the converse is true — God created all things in six days because the number is perfect."

Medieval scholars kept the tradition alive for centuries afterwards, hunting for perfection in calendars and biblical genealogies. None of it was necessary mathematically — Euclid's proof needs no calendar and no theology — but it's a charming reminder that a clean arithmetic fact, once discovered, tends to get dressed up in whatever story a culture finds most meaningful.

It's a lovely piece of numerology, but it's worth being clear-eyed about it: nothing about the calendar or Genesis explains why divisor sums behave this way, and no mystical property of 6 or 28 was needed to derive them — Euclid's theorem, sitting quietly above, does the whole job with ordinary arithmetic.

See it explained