Jason Hutchens: power summation

Jason Hutchens: power summation

Which numbers satisfy the following property... the sum of the individual digits of the number raised to the power of that digit is equal to the number itself? For the purpose of this problem, we define 0^0=0.

For example, the number 3435 is known to have this property, since 3^3 + 4^4 + 3^3 + 5^5 = 3435.

This problem proved rather easy to solve. We know that no numbers above 10*9^9 (about 4e9) can have this property, simply because the sum will always be less than the original number. Therefore we can solve the problem by brute force, using unsigned 32-bit integers.

I wrote such a program, and it took a few hours to execute on our SGI Onyx computer. The solution set is { 0, 1, 3435, 438579088 }.

If you're interested in this puzzle, please feel free to download the source code. One David Conrad optimized my solution to run in under 15 minutes, and his code is also available. And now Geoff Bailey, AKA Fred the Wonder Worm, optimized David's program to run about 8 times faster. You can download his source code, too.