Perfection
Time limit1sMemory limit128 MB
For each number below 60000, sum its proper divisors and classify it as perfect, deficient, or abundant.
- Level
Easy2 of 10
- Topics
- Math, Number theory, Brute force
- Solved
- No attempts yet
Problem
Given a positive integer, determine whether it is perfect, abundant, or deficient.
If integers satisfy , then is a multiple of and of , and and are divisors of . A proper divisor of a positive integer is any positive divisor other than the number itself ( counts as a proper divisor; the number itself does not).
Classify a number by the sum of its proper divisors:
- PERFECT: the sum of the proper divisors equals the number itself. For example, and are perfect.
- DEFICIENT: the sum of the proper divisors is smaller than the number. For example, the proper divisors of are , which sum to , so is deficient.
- ABUNDANT: the sum of the proper divisors is larger than the number. For example, the proper divisors of are , which sum to , so is abundant.
Input
positive integers are given, separated by spaces or newlines. Each integer is at most 60,000, and . A value of marks the end of the list ( itself is not processed).
Output
Print one line for each input integer. Each line has the form integer verdict, with a single space between the integer and the verdict. The verdict is PERFECT if the number is perfect, DEFICIENT if deficient, and ABUNDANT if abundant. Keep the same order as the input.