[Tutor] where I am going wrong?
bob gailer
bgailer at gmail.com
Fri Dec 16 06:13:07 CET 2011
Suggestions for potentially simpler and more efficient code.
Create a ruple of the 5th powers of the 10 digits and look them up
(should be faster than recomputing the 5th power each time) (0, 1, 16, ... )
Instead of trying all permutations of digits, use combinations. 12345
will yield the same sum-of-5th-powers as 23154. Compute the sum then
see if it is composed of the source digits.
--
Bob Gailer
919-636-4239
Chapel Hill NC
More information about the Tutor
mailing list