How can a computer find perfect numbers?
Here is the program that I used to calculate the first five perfect numbers that I found. This is the slow version that tests every possible number. Once I observed that each succeeding number had more powers of two, I started checking only multiples of succeeding powers of two. That logic is not included here, because it could theoretically let you miss a number (even though it didn’t).