Deficient, Perfect, and Abundant
InterviewTime limit1sMemory limit128 MB
For each integer, sum its proper divisors and classify it as deficient, perfect, or abundant.
- Level
Easy3 of 10
- Topics
- Math, Number theory, Implementation
- Solved
- No attempts yet
Problem
Read several positive integers and, for each one, determine whether it is deficient, perfect, or abundant.
The proper divisors of a positive integer are its divisors that include but exclude itself. Let be the sum of the proper divisors of . Then:
- if , the number is perfect;
- if , the number is deficient;
- if , the number is abundant.
For example, the proper divisors of are , and their sum is , so is a perfect number.
Input
The first line contains the number of integers that follow. Each of the next lines contains one integer. Every input integer is greater than and less than (that is, ).
Output
For each integer, output the number together with its classification on its own line:
n is a deficient number.if it is deficient;n is a perfect number.if it is perfect;n is an abundant number.if it is abundant.
Here n is the input value. Print one blank line between consecutive results.