Mathematics · Number Theory
Perfect Number Checker
Determines whether a given positive integer is a perfect number by checking if the sum of its proper divisors equals the number itself.
Calculator
Formula
A positive integer n is perfect if and only if the sum of all its positive divisors σ(n) equals 2n, which is equivalent to saying the sum of its proper divisors (all divisors excluding n itself) equals n. For example, for n = 6: divisors are 1, 2, 3, 6, so σ(6) = 12 = 2 × 6.
Source: Euclid, Elements Book IX, Proposition 36; Hardy & Wright, An Introduction to the Theory of Numbers, 6th ed.
How it works
The concept of perfect numbers dates back over 2,300 years to Euclid's Elements. A number n is called perfect when its proper divisors — every positive integer less than n that divides n evenly — sum to exactly n. Equivalently, using the sum-of-divisors function σ(n), a number is perfect if and only if σ(n) = 2n. Numbers where the proper divisor sum is less than n are called deficient, and numbers where it exceeds n are called abundant.
The algorithm iterates through every integer from 1 to n−1, checks divisibility, and accumulates the sum. For a number n, the formula evaluated is: σ(n) = Σ d where d | n, and the test is whether σ(n) − n = n. The four smallest known perfect numbers are 6 (1+2+3), 28 (1+2+4+7+14), 496, and 8128. All known perfect numbers are even and generated by the Euclid–Euler theorem: n = 2^(p−1) × (2^p − 1) where 2^p − 1 is a Mersenne prime.
Perfect number theory has applications in recreational mathematics, cryptographic research, and the study of Mersenne primes. The search for odd perfect numbers — none of which have ever been found — remains one of the oldest unsolved problems in mathematics. Computer scientists use related divisor-sum algorithms in factoring, primality testing, and the analysis of arithmetic functions.
Worked example
Example 1: n = 28
Find all proper divisors of 28: 1, 2, 4, 7, 14. These are all positive integers less than 28 that divide it without remainder. Sum them: 1 + 2 + 4 + 7 + 14 = 28. Since the divisor sum equals n, 28 is a perfect number. Using the Euclid–Euler formula with p = 2: 2^(3−1) × (2^3 − 1) = 4 × 7 = 28 ✓
Example 2: n = 12
Proper divisors of 12: 1, 2, 3, 4, 6. Sum: 1 + 2 + 3 + 4 + 6 = 16. Since 16 > 12, the proper divisor sum exceeds n, so 12 is an abundant number, not perfect.
Example 3: n = 8
Proper divisors of 8: 1, 2, 4. Sum: 1 + 2 + 4 = 7. Since 7 < 8, the sum is less than n, making 8 a deficient number.
Example 4: n = 496
The proper divisors of 496 are 1, 2, 4, 8, 16, 31, 62, 124, 248. Their sum: 1+2+4+8+16+31+62+124+248 = 496. Confirmed: 496 is the third perfect number, corresponding to Mersenne prime 2^5 − 1 = 31.
Limitations & notes
This checker uses a brute-force O(n) trial division algorithm, meaning it slows considerably for very large integers — numbers above several million may cause noticeable computation delays in a browser environment. For large inputs, optimized O(√n) algorithms that only iterate to √n and use symmetric divisor pairs are preferred. Additionally, this tool only handles positive integers; the concept of perfect numbers is undefined for negative numbers, fractions, or zero. For numbers beyond roughly 10^8, specialized arbitrary-precision libraries and probabilistic methods are required. Lastly, while all known perfect numbers are even, no odd perfect number has ever been proven to exist or not exist — this remains an open problem, so the absence of odd results from this tool reflects computational limits, not a proof of impossibility.
Frequently asked questions
What are the first five perfect numbers?
The first five known perfect numbers are 6, 28, 496, 8128, and 33,550,336. They correspond to Mersenne primes generated by 2^p − 1 for p = 2, 3, 5, 7, and 13 respectively. Each subsequent perfect number grows dramatically in size.
Has an odd perfect number ever been found?
No odd perfect number has ever been discovered, and none has been proven to be impossible. It is one of the oldest unsolved problems in mathematics. If an odd perfect number exists, it must be greater than 10^1500 and satisfy dozens of strict constraints.
What is the Euclid–Euler theorem for perfect numbers?
The Euclid–Euler theorem states that every even perfect number has the form 2^(p−1) × (2^p − 1), where 2^p − 1 is a Mersenne prime. Euclid proved the 'if' direction around 300 BCE, and Euler proved the 'only if' direction in the 18th century, completing the characterization of all even perfect numbers.
What is the difference between perfect, abundant, and deficient numbers?
A perfect number has a proper divisor sum exactly equal to itself. An abundant number has a proper divisor sum greater than itself (e.g., 12 with divisor sum 16). A deficient number has a proper divisor sum less than itself (e.g., 8 with divisor sum 7). All prime numbers are deficient.
Why is 1 not considered a perfect number?
The number 1 has no proper divisors — there is no positive integer less than 1 that divides it — so its proper divisor sum is 0, not 1. By definition, a perfect number must equal its proper divisor sum, and since 0 ≠ 1, the number 1 is classified as deficient, not perfect.
Last updated: 2025-01-15 · Formula verified against primary sources.