Perfect Number Verifier
Perfect Number Verifier determines if a number \\( n \\) is a perfect number by checking if the sum of its proper divisors equals \\( n \\), and plots the sum of proper divisors for a range of numbers.
Perfect Numbers
A number \\( n \\) is perfect if the sum of its proper divisors (all positive divisors excluding \\( n \\) itself) equals \\( n \\).
Definition:
\\[ \sigma(n) – n = n \\]where \\( \sigma(n) \\) is the sum of all divisors of \\( n \\), including \\( n \\).
Properties:
- Euclid proved that if \\( 2^p – 1 \\) is prime (a Mersenne prime), then \\( 2^{p-1}(2^p – 1) \\) is a perfect number.
- All known perfect numbers are even, and no odd perfect numbers have been found.
- Examples of perfect numbers: 6, 28, 496, 8128.
Examples
Example 1
Input: \\( n = 6 \\)
Proper divisors: \\( \{1, 2, 3\} \\).
Sum: \\( 1 + 2 + 3 = 6 \\).
Since \\( 6 = 6 \\), \\( n = 6 \\) is a perfect number.
Example 2
Input: \\( n = 28 \\)
Proper divisors: \\( \{1, 2, 4, 7, 14\} \\).
Sum: \\( 1 + 2 + 4 + 7 + 14 = 28 \\).
Since \\( 28 = 28 \\), \\( n = 28 \\) is a perfect number.
Example 3
Input: \\( n = 12 \\)
Proper divisors: \\( \{1, 2, 3, 4, 6\} \\).
Sum: \\( 1 + 2 + 3 + 4 + 6 = 16 \\).
Since \\( 16 \neq 12 \\), \\( n = 12 \\) is not a perfect number.