This is the first in a new series of posts that I will regularly write to give you a little challenge to do. Today’s programming challenge of the day (PCOD) is to create a program that prints perfect numbers.
A perfect number is an integer that is equal to the sum of it’s divisors (excluding itself). An example perfect number is 6. 6 can be cleanly divided by 1, 2 and 3. 1 + 2 + 3 = 6. Therefore 6 is a perfect number.
The program should expose a single function that takes a single argument (the argument is a integer equal to the maximum number of times the program will loop over increasing integers to find the perfect numbers):
You can write your program in any language of your choosing. Post your answer in the comments. The most elegant solution will receive my appreciation (no prizes sorry).