Abundant and Deficient Numbers
The topic of abundant and deficient numbers arises from number theory. There are three types of numbers this code will analyze:
- A number is deficient if the sum of its divisors is less than twice the number
- A number is abundant if the sum of its divisors is more than twice the number
- A number is perfect if the sum of its divisors are equal to twice the number
The first task is to find all divisors of a given number and to sum them. It is then simple to compare this sum to twice the number and determine the type of number we have. The code will then return the number, followed by its classification, followed by the amount by which the number is abundant, if it is abundant.