Ladies and Gentlemen, does anyone have a clue as to writing a formula to test for Perfect number?

Example:

1+2+3=6 6 is a perfect number

1+2+3+4=10 10 is not a perfect number. Supposedly a perfect number is a positive number greater then 2 whose factors add up to the number itself.

I am writing a program that requires the user to input a potential number, test it, if it is true, then print out the factors. If it is not a perfect number, then say Sorry your number is not perfect.

All your help is greatly appreciated as you have done a wonderful job of helping me in the past.

The Ski