Aliquot Sum
InterviewTime limit8sMemory limit1024 MB
For each of up to a million numbers, sum its proper divisors and report whether it is abundant, deficient, or perfect.
- Level
Easy3 of 10
- Topics
- Math, Number theory, Implementation, Prefix sum
- Solved
- No attempts yet
Problem
A divisor of a positive integer is an integer such that is an integer. In this problem, we define the aliquot sum of a positive integer as the sum of all divisors of other than itself. For example, , , and .
With the aliquot sum, we can classify positive integers into three types: abundant numbers, deficient numbers, and perfect numbers. The rules are as follows.
- A positive integer is an abundant number if .
- A positive integer is a deficient number if .
- A positive integer is a perfect number if .
You are given a list of positive integers. Write a program to classify them.
Input
The first line of the input contains one positive integer , the number of test cases. The second line contains space-separated positive integers .
Output
Output lines. If is an abundant number, print abundant on the -th line. If is a deficient number, print deficient on the -th line. If is a perfect number, print perfect on the -th line.
Constraints
- for .