A number theory hobbyist classifies positive integers by comparing them to the sum of their own proper divisors (all divisors of n except n itself).
Given n, let s be the sum of the proper divisors of n. Output:
perfect if s == nabundant if s > ndeficient if s < nLine 1: a single integer n.
One word: perfect, abundant, or deficient.
Example 1
Input
28
Expected
perfect
Explanation
Proper divisors of 28 are 1,2,4,7,14, summing to 28, so it is perfect.
Example 2
Input
12
Expected
abundant
Explanation
Proper divisors of 12 are 1,2,3,4,6, summing to 16 > 12, so it is abundant.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →