Perfect Number Checker
Check if a number is perfect, deficient, or abundant. Find proper divisors and divisor sums.
Find Perfect Numbers
Known Perfect Numbers
About this tool
Perfect numbers represent a rare mathematical phenomenon where a positive integer equals the sum of its proper divisors—a property so elegant that ancient mathematicians considered them sacred. These numbers are profoundly connected to the study of number theory, prime factorization, and mathematical beauty, making them more than mere curiosities. Perfect numbers have captured mathematicians' imagination for over two thousand years, and their mystery continues today with only 51 known examples despite centuries of searching.
Use this checker to explore the classification of any integer: is it perfect, abundant (with divisor sum exceeding itself), or deficient (with divisor sum falling short)? The tool instantly computes all proper divisors and their sum, providing complete transparency into the number's structure. This is invaluable for students learning divisibility properties, mathematicians investigating number-theoretic patterns, researchers working on Mersenne prime algorithms, or anyone curious about the hidden arithmetic structure within numbers.
Interestingly, all known perfect numbers are even and follow Euler's elegant formula: 2^(p−1) × (2^p − 1) where (2^p − 1) is a Mersenne prime. The search for new perfect numbers is equivalent to discovering new Mersenne primes—a quest that connects recreational mathematics with cutting-edge computational research through projects like GIMPS. Whether you're verifying a conjecture, teaching divisor properties, or simply marveling at mathematical structure, this tool transforms abstract number theory into tangible, verifiable results.
Frequently Asked Questions
Code Implementation
def get_proper_divisors(n: int) -> list[int]:
"""Get all proper divisors of n (excluding n itself)."""
if n <= 1:
return []
divisors = [1]
i = 2
while i * i <= n:
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n // i)
i += 1
return sorted(divisors)
def check_perfect(n: int) -> dict:
"""Check if n is perfect, deficient, or abundant."""
if n <= 0:
return {"error": "Must be positive"}
divisors = get_proper_divisors(n)
divisor_sum = sum(divisors)
if divisor_sum == n:
classification = "perfect"
elif divisor_sum < n:
classification = "deficient"
else:
classification = "abundant"
return {
"number": n,
"divisors": divisors,
"divisor_sum": divisor_sum,
"is_perfect": divisor_sum == n,
"classification": classification,
"difference": n - divisor_sum
}
# Known perfect numbers
perfect_numbers = [6, 28, 496, 8128, 33550336]
for p in perfect_numbers:
r = check_perfect(p)
print(f"{p}: {r['classification']} (divisors sum = {r['divisor_sum']})")
print(f" Divisors: {r['divisors']}")
# Find abundant numbers up to 100
print("\nAbundant numbers up to 100:")
abundant = [n for n in range(2, 101) if check_perfect(n)["classification"] == "abundant"]
print(abundant)Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.