# Finding Abundant, Deficient, and Perfect Numbers

A proper divisor of a positive integer $n$ is an integer $d$ that divides $n$ evenly (i.e., with a remainder of $0$) with $0 \lt d \lt n$. A number is said to be perfect if it equals the sum of its proper divisors. For example, $6 = 1 + 2 + 3$ and $28 = 1 + 2 + 4 + 7 + 14$, so both $6$ and $28$ are perfect numbers.

Alternatively, if the sum of a number's proper divisors exceeds the number itself, it is said to be abundant, while if the sum of a number's proper divisors is less than the number itself, it is said to be deficient.

1. Write a class named SumOfDivisorsClassifier whose main method prompts the user for a number $n$ and then classifies the positive integers from 2 to $n$ as either abundant, deficient, or perfect. Include in your code a method named sumProperDivisors() that calculates the sum of the proper divisors of a given number as shown below:

System.out.print(sumProperDivisors(12)); \\ prints "16"


Sample run:

This program will classify 2 through n as abundant, deficient, or perfect.
------------------------------------------------------------------------------
Enter n: 20
2 is deficient
3 is deficient
4 is deficient
5 is deficient
6 is perfect
7 is deficient
8 is deficient
9 is deficient
10 is deficient
11 is deficient
12 is abundant
13 is deficient
14 is deficient
15 is deficient
16 is deficient
17 is deficient
18 is abundant
19 is deficient
20 is abundant
2. Perfect numbers are actually very rare. In fact, as of February 2016, there are only 49 perfect numbers known to exist! The last one was just discovered this year too! (See the list.) Interestingly, all of the known perfect numbers happen to be even, but nobody has proven that an odd one can't exist --if you should find one, you'll be quite famous mathematically!

Write a class named PerfectNumberFinder whose main method will prompt the user for some maximum positive integer $n$ to be considered, and then prints all perfect numbers from 2 to $n$. As you do this, re-use the method sumProperDivisors() mentioned in part (a) above. Also, as calculating these numbers can take some time, and the user might get confused as to whether the program has concluded or just in the middle of a lengthy computation -- the word "done" should be printed when the method concludes.

Sample run:

This program will find all of the perfect numbers below a given n
-----------------------------------------------------------------
Enter n: 500
6
28
496
done