Java
UNIT CHALLENGES

separator-blank.png

ALTERNATIVE AP CHALLENGE


separator-blank.png

CHALLENGE 3 – PERFECTION

Write a program that asks the user for a number and outputs whether or not it is a perfect number.


HINTS

·         A perfect number is a number that has divisors that add up to twice the number itself. 

·         The first perfect number is 6 because its divisors are 1, 2, 3 and 6 and 1+2+3+6=12.

·         The second perfect number is 28 because its divisors are 1, 2, 4, 7, 14, 28 and they add up to 56.

·         Finding if a number is perfect or not requires you to find and sum up all its divisors.  Its turns out to be quite similar to finding out if a number is a prime or not.

FUN FACTS

·         Perfect numbers are pretty rare.  The first five are 6, 28, 496, 8128 and 33550336.

·         The first four were known around 400BC, but the fifth one was discovered in the 1400s (we think).  Imagine having to find and total all the divisors for 33550336 without a computer!  Yikes!

·         We still don't know if there is an infinite amount of perfect numbers or not.

·         We haven't discovered an odd perfect number.  We don't know if any exist.

separator-campeau.png