Friday, March 8, 2013

project euler problem 030

Digit fifth powers

Another simple problem. One may need a moment's thought to give a reasonable upper bound for this problem.

Although the problem can be bruteforced out easily,  from a programmer's point of view, an efficient algorithm  is preferred. An efficient approach exists for this problem, the numbers checked in the efficient approach is very limited. For example, check only less than 4000 numbers for power = 5 and less than 10000 numbers for power = 6.



The trick is that we can always try large digit first.

No comments:

Post a Comment