Problem 62
30 January 2004
The cube, 41063625 (3453), can be permuted to produce two other cubes: 56623104 (3843) and 66430125 (4053). In fact, 41063625 is the smallest cube which has exactly three permutations of its digits which are also cube.
Find the smallest cube for which exactly five permutations of its digits are cube.
def fun62():
d = {}
for i in range(10000):
t = i**3
l = map(int, str(t))
l.sort()
d[str(l)] = d.get(str(l), []) + [t]
if len(d[str(l)]) == 5:
print l, d[str(l)]
return d[str(l)][0]
answer is 127035954683,
这5个数为[127035954683L, 352045367981L, 373559126408L, 569310543872L, 589323567104L]
[5027, 7061, 7202, 8288, 8384]的立方
time:0.344000101089
阅读(515) | 评论(0) | 转发(0) |