Perfect Number Finder

Add up the proper divisors of a number and see where the total lands. Check a list, run a census up to 2,000,000, or build a perfect number from a Mersenne prime.

Commas, spaces or new lines between entries. Up to 200 whole numbers per run. Full divisor sums up to 1,000,000,000,000, and a perfect or not-perfect verdict on longer numbers up to 3,000 digits. Ctrl+Enter runs the check.

28 balances. 30 overshoots.

Write out every divisor of 28 below 28 itself: 1, 2, 4, 7 and 14. Add them up.

1+2+4+7+14=28

The total matches the number, so 28 is perfect. Now try 30. Its proper divisors are 1, 2, 3, 5, 6, 10 and 15, which add to 42. The total overshoots by 12, so 30 is abundant. Try 25: 1 + 5 = 6, far short, so 25 is deficient.

Every whole number above 1 lands in one of those three bins. The total has a name, the aliquot sum, written s(n). Textbooks also use σ(n), the sum of all divisors with n included. A perfect number has σ(n) = 2n, which is why each result row on the Check tab shows the abundancy index σ(n)/n. Perfect numbers score exactly 2.000.

Three bins, nowhere near equal

Deficient · s(n) < n 7,508 of the first 10,000

Every prime, every power of a prime, and most odd numbers. A prime has one proper divisor, 1, so the sum never gets close.

Perfect · s(n) = n 4 of the first 10,000

6, 28, 496 and 8,128. After 8,128 the next one is 33,550,336, more than four thousand times larger.

Abundant · s(n) > n 2,488 of the first 10,000

12 is the first. Every multiple of 6 past 6 sits here, because a multiple of a perfect or abundant number inherits its divisors and gains more.

Widen the census to 1 through 1,000,000 and the split holds near three to one: 752,451 deficient, 247,545 abundant, and the same four perfect numbers. The abundant share settles around 24.76% as the range grows. Odd abundant numbers are the rare ones. The first is 945 (divisor sum 975), and the Scan tab names the first odd abundant number in any window you pick.

The 2p − 1 recipe

Euclid wrote the construction around 300 BC, in Book IX of the Elements. About two thousand years later Euler proved the converse: every even perfect number comes from this recipe and from nowhere else.

  1. Pick a prime exponent. Take p = 5.
  2. Compute 2p − 1 and test for primality. 25 − 1 = 31, a prime. Primes of this shape are called Mersenne primes.
  3. Multiply by 2p−1. 16 × 31 = 496. Its proper divisors add to 496.

Step two is where the recipe usually breaks. A prime exponent does not promise a prime result. p = 11 gives 2,047, and 2,047 = 23 × 89. The Build tab runs the Lucas-Lehmer test on 2p − 1, and when the test fails it searches for a factor of the form 2kp + 1, the only shape a factor of a Mersenne number with prime exponent takes. Both 23 and 89 fit: 23 = 2·1·11 + 1 and 89 = 2·4·11 + 1.

Perfect numbers by the date someone first wrote them down
pPerfect numberDigitsFirst recorded
2, 3, 5, 76, 28, 496, 8,1281 to 4Listed by Nicomachus, around AD 100
1333,550,3368A German manuscript, around 1460
17, 198,589,869,056 and 137,438,691,32810, 12Pietro Cataldi, 1588
312,305,843,008,139,952,12819Leonhard Euler, 1772
127Too long for this column77Édouard Lucas, 1876
61Too long for this column37Ivan Pervushin, 1883
521 to 2,281Five numbers314 to 1,373Raphael Robinson on the SWAC computer, 1952
136,279,841The 52nd knownAbout 82 millionLuke Durant through GIMPS, October 2024

Order of discovery did not follow size. Lucas proved 2127 − 1 prime seven years before Pervushin settled the smaller 261 − 1, and Lucas's prime stayed the largest known prime for 75 years. Since Robinson, every new perfect number has come from a computer search. The Build tab takes exponents up to 5,000, which covers the first 20 Mersenne primes. Load p = 4423 and the page prints all 2,663 digits of the 20th perfect number.

Nobody has found an odd one

All 52 known perfect numbers are even. Nobody has proved odd ones impossible either. Descartes posed the question in a 1638 letter to Mersenne, and the answer is still missing. Decades of work have only fenced in where one would have to hide.

An odd perfect number, if one exists, has to:

  • be larger than 101500 (Ochem and Rao, 2012)
  • have at least 101 prime factors, counting repeats (same paper)
  • have at least 10 different prime factors (Nielsen, 2015)

The Check tab puts the first bound to work. An odd entry above 1012 is too large to factor in a browser, but any odd number shorter than 1,501 digits still gets a firm not perfect from the bound alone. Even entries of any length up to 3,000 digits get an exact verdict from the Euclid-Euler form.

Fast tells for even perfect numbers

Use these to throw out candidates, never to confirm one. 16 ends in 6, 10 is triangular, and neither is perfect.

Numbers that come close

Numbers(n)Why this one stands out
1,0241,023Every power of 2 falls short by exactly one. These are the almost perfect numbers.
1216The smallest abundant number.
7074Abundant, yet no subset of its divisors adds to 70. The smallest weird number.
220284Amicable with 284, whose proper divisors add back to 220. Load the 200 to 1,300 range to see two such pairs.
945975The smallest odd abundant number.
2,047113211 − 1. Prime exponent, composite result, so the recipe produces nothing.

The mirror image of an almost perfect number would overshoot by exactly one. Such numbers are called quasiperfect. None has been found, and any that exists must be an odd square above 1035.

Where this page stops

Check tab
Full divisor sums up to 1012, by trial division to the square root. Longer entries, up to 3,000 digits, get a perfect or not-perfect verdict but no abundant or deficient label, because splitting a 20-digit composite by trial division would freeze the page. 200 entries per run.
Scan tab
The window ends at 2,000,000. The fifth perfect number is 33,550,336, so no scan here shows more than four. For the fifth, use the Build tab with p = 13. CSV export covers windows up to 200,000 numbers.
Build tab
Exponents 2 to 5,000. Lucas-Lehmer at p = 4,423 takes a fraction of a second on a laptop, more on an older phone. The 21st Mersenne exponent, 9,689, sits outside the limit.
Factor search
When 2p − 1 fails, the page tries 2kp + 1 for k up to 50,000. Some Mersenne composites have no factor that small, and the result says so instead of guessing. 267 − 1 is the famous case: its smallest factor is 193,707,721, and Frank Nelson Cole presented it in 1903 by multiplying out the two factors on a blackboard without speaking.

This page answers one question per number: how do its divisors add up. For the full divisor table and factor pairs of a single number, the factor calculator lays them out better. To sort a list into primes and composites, use the prime number filter, and to turn the binary pattern of a perfect number back into decimal, the binary to decimal converter takes the string as is.

Perfect number questions

Edge cases, big inputs, and what each verdict on this page rests on.

Is 1 a perfect number?

No. 1 has no proper divisors, so its aliquot sum is 0. The Check tab labels 1 deficient. Zero and negative numbers are skipped, since divisor sums are defined for positive whole numbers only.

Why does a 19-digit entry say perfect without listing divisors?

Above 10^12 the page stops factoring. For an even entry the page splits off the powers of 2, writing n as 2^k × m, then checks whether m equals 2^(k+1) − 1 and passes Lucas-Lehmer. Euler proved every even perfect number has this form, so the verdict is exact without a divisor list.

How many perfect numbers are known?

52, one for each known Mersenne prime. The latest, from October 2024, is 2^136,279,840 × (2^136,279,841 − 1). Whether the list goes on forever is open, since nobody has proved there are infinitely many Mersenne primes.

What does "abundant by 12" mean in a result row?

The proper divisors add to 12 more than the number itself. For 30 they sum to 42. A deficient row shows the shortfall instead, and the bar beside each row draws the divisor sum against the number.

Why did p = 11 fail when 11 is prime?

A prime exponent is required for 2^p − 1 to be prime, but not enough on its own. 2^11 − 1 = 2,047 = 23 × 89. Of the 669 primes below 5,000, only 20 give a Mersenne prime.

Why does the Scan tab list an amicable partner outside my range?

A pair counts if either member falls inside the window. The partner outside is checked on its own by factoring, so scanning 1,000 to 1,200 still reports 1,184 with 1,210.

Why stop the scan at 2,000,000?

The divisor-sum sieve holds one value per number in memory, and 2,000,000 values stay light on a phone. A bigger ceiling would add nothing new on the perfect side, since the next perfect number after 8,128 is 33,550,336.

Does any of this leave my browser?

No. Factoring, sieving and the Lucas-Lehmer test all run in the page. Nothing is sent to a server, and a refresh clears every input.