Can someone please tell me how to write the algorithm that determines if a number is a 'perfect number'? I know that the first four perfect numbers are 6, 28, 496, and 8128. I also know that a perfect number is a number that is equal to the sum of all of its factors plus 1. (excluding the number itself) Ex: 6 = 1 + 2 + 3
I just can't seem to figure out the algorithm to use this in a program function that would determine if a number is a 'perfect number'.