Under construction

Still being built. Things may change

Aliquot Sum

Interview

Time limit8sMemory limit1024 MB

Summary
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 nn is an integer dd such that m=ndm = \frac{n}{d} is an integer. In this problem, we define the aliquot sum s(n)s(n) of a positive integer nn as the sum of all divisors of nn other than nn itself. For example, s(12)=1+2+3+4+6=16s(12) = 1 + 2 + 3 + 4 + 6 = 16, s(21)=1+3+7=11s(21) = 1 + 3 + 7 = 11, and s(28)=1+2+4+7+14=28s(28) = 1 + 2 + 4 + 7 + 14 = 28.

With the aliquot sum, we can classify positive integers into three types: abundant numbers, deficient numbers, and perfect numbers. The rules are as follows.

  1. A positive integer xx is an abundant number if s(x)>xs(x) > x.
  2. A positive integer yy is a deficient number if s(y)<ys(y) < y.
  3. A positive integer zz is a perfect number if s(z)=zs(z) = z.

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 TT, the number of test cases. The second line contains TT space-separated positive integers n1,…,nTn_1, \dots, n_T.

Output

Output TT lines. If nin_i is an abundant number, print abundant on the ii-th line. If nin_i is a deficient number, print deficient on the ii-th line. If nin_i is a perfect number, print perfect on the ii-th line.

Constraints

  • 1≤T≤1061 \le T \le 10^6
  • 1≤ni≤1061 \le n_i \le 10^6 for i∈{1,2,…,T}i \in \{1, 2, \dots, T\}.

Examples1

  1. Example 1

    Input
    3
    12 21 28
    
    Expected output
    abundant
    deficient
    perfect