Perfect Number
checker.
See if a number is perfect, abundant or deficient by adding up its proper divisors.
- Proper divisors add to
- 28
- Above or below n
- 0
- Divisors in all
- 6
28 is perfect: its proper divisors add up to exactly 28. It comes from the Mersenne prime 7, as every even perfect number does.
Divisors against the number
The proper divisors of 28 add up to 28, drawn to the same scale as 28. The sum ends exactly at the dashed line.
Divisor pairs
| Divisor d | Partner n ÷ d |
|---|---|
| 1 | 28 |
| 2 | 14 |
| 4 | 7 |
Where it sits
σ(n) ÷ n is 2. The three classes are those of OEIS A005100, A000396 and A005101.
Working
- 1Only test divisors up to √n√28 rounds down to 5, so test d = 1 to 5
- 2Each divisor d brings its partner n ÷ d1 × 28, 2 × 14, 4 × 7
- 3Leave out n itself and add the rest1 + 2 + 4 + 7 + 14 = 28
- 4Compare the sum with n28 = 28, so n is perfect
- 5Euclid–Euler form28 = 22 × (23 − 1) = 4 × 7
- 6Check: σ(n), the sum of all divisors, against 2nσ(28) = 56 = 2 × 28
Scan a range
Perfect: 6, 28, 496, 8,128. The smallest odd abundant number is 945.
The 52 known perfect numbers
| # | p | Perfect number | Digits |
|---|---|---|---|
| 1 | 2 | 61 digits | 1 |
| 2 | 3 | 282 digits | 2 |
| 3 | 5 | 4963 digits | 3 |
| 4 | 7 | 8, | 4 |
| 5 | 13 | 33, | 8 |
| 6 | 17 | 8, | 10 |
| 7 | 19 | 137, | 12 |
| 8 | 31 | 2, | 19 |
Each row is 2p − 1 × (2p − 1), where 2p − 1 is a Mersenne prime, for the 52 exponents p known since October 2024.
How it's worked out
The proper divisors of a number are the whole numbers that divide it exactly, leaving the number itself out. Add them up and compare the sum with the number. If they match, the number is perfect. If the sum is bigger it is abundant, and if it is smaller it is deficient.
Number theory books often use σ(n), the sum of all the divisors with n included. A perfect number then has σ(n) equal to 2n. Dividing σ(n) by n gives the abundancy: exactly 2 for a perfect number, above 2 for an abundant one, below 2 for a deficient one.
Divisors come in pairs. If d divides n, so does n over d, and one of the two is at most the square root of n. So the tool only tests d from 1 up to that root and takes both numbers of each pair. For 28 the root rounds down to 5, and the pairs are 1 × 28, 2 × 14, 4 × 7. A number near one trillion needs about a million trials this way, not a trillion.
Every even perfect number has one shape. Euclid showed that when 2 to the power p, minus 1, is prime, the product below is perfect, and Euler showed that every even perfect number has this form. A prime of the form 2 to the p minus 1 is a Mersenne prime, so each one gives exactly one even perfect number.
Worked examples
Noor checks why 28 is called perfect
Noor reads that 28 is a perfect number and wants to see it for herself. Its proper divisors are 1, 2, 4, 7, 14. They add up to 28, the number itself.
The check adds 28 back in: σ(28) is 56, which is 2 times 28. In the Euclid and Euler form, 28 is 4 times 7, with p equal to 3. The 7 is 2 cubed minus 1, a Mersenne prime.
Kai finds the smallest abundant number
For a coding puzzle on abundant numbers, Kai starts with 12. Its proper divisors are 1, 2, 3, 4, 6, and they add up to 16. That is 4 more than 12, so 12 is abundant, and no smaller number is (OEIS A005101 starts at 12).
Any multiple of an abundant number is abundant too. The divisors of 24 include twice each divisor of 12, so they add up to 36, which is 12 more than 24.
Theo looks for an odd abundant number
Theo notices that every abundant number he finds is even, so he scans every number up to 1,000. Of those, 246 are abundant, and the only odd one is 945. That matches OEIS A005231, which starts at 945.
945 has 15 proper divisors, which add up to 975, so it is abundant by 30. As a fraction in lowest terms, σ(945) over 945 is 128 over 63. Odd numbers lack the divisor 2, which does most of the work for even numbers, so odd abundant numbers are rare.
Reading your result
Most numbers are deficient. Every prime is, since its only proper divisor is 1: for 97 the sum is 1. Up to 10,000, 7,508 numbers are deficient and 2,488 are abundant. Abundant numbers make up just under a quarter of all numbers. Deléglise proved their share lies between 0.2474 and 0.2480, as noted in A005101.
Powers of 2 miss by one. The proper divisors of 64 add up to 63, one short, and the same happens for every power of 2. And 1 is deficient: it has no proper divisors, so its sum is 0.
Perfect numbers are very rare. Only 4 of the numbers up to 10,000 are perfect: 6, 28, 496, 8,128. GIMPS lists 52 known Mersenne primes, so 52 perfect numbers are known. The largest, from p equal to 136,279,841 (found in October 2024), has 82,048,640 digits.
Common mistakes
- Adding the number itself. If you include n in the sum, every number looks abundant. Either leave n out and compare with n, or keep it in and compare σ(n) with 2n.
- Missing the partner of each divisor. Testing up to the square root only works if you keep both numbers of each pair. For 28, finding 4 means you also have 7.
- Counting a square root twice. For 36, the pair 6 × 6 gives one divisor, not two. Counting it twice adds 6 to the sum.
- Thinking every even number is abundant. Many are, but 2, 4, 8, 10, 14 and 16 are all deficient, and 28 is perfect.