2019-07-18 03:29:59 +02:00
|
|
|
|
|
|
|
def euler_062():
|
2019-07-18 20:23:44 +02:00
|
|
|
solutions = {}
|
|
|
|
for n in range(1, 10000):
|
|
|
|
cube = n * n * n
|
|
|
|
try:
|
|
|
|
key = "".join(sorted(str(cube)))
|
|
|
|
solutions[key].append(cube)
|
|
|
|
if len(solutions[key]) > 4:
|
|
|
|
# print(solutions[key])
|
|
|
|
s = solutions[key][0]
|
|
|
|
break
|
|
|
|
except KeyError:
|
|
|
|
solutions[key] = [cube]
|
|
|
|
return s
|
2019-07-18 03:29:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
print("e062.py: " + str(euler_062()))
|
2019-07-18 20:23:44 +02:00
|
|
|
assert(euler_062() == 127035954683)
|