Submitted by manoj on
coding-cability

Perfect Number: A (positive integer) number is called a perfect number, if the sum of all of its factors, except the number itself, is equal to the number itself, then that number is called a perfect number.

For example, all the factors of number 6 are: 1, 2, 3, and 6. But, we have to remove 6 from that list; so if you add 1 + 2 + 3; you get 6! So, 6 is a perfect number.

Problem Statement: Write a program to find all perfect numbers between 1 and given number N.

Interesting tidbits: Check out this interesting relationship between Perfect Numbers and Mersenne Primes:

www.youtube.com/watch?v=T0xKHwQH-4I

(You are encouraged to share the YouTube video link with candidate after completing the question - as a good gesture).