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

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to