Solve problem

This commit is contained in:
2020-10-12 22:20:47 +02:00
parent d770dd831e
commit 34980ed0b4

View File

@@ -0,0 +1,18 @@
def has5Permutations(n):
return numberList[len(n)].count(n) == 5
numberList = [[] for _ in range(100)]
i=1
while True:
n = i**3
sortedN = ''.join(sorted(str(n)))
numberList[len(sortedN)].append(sortedN)
if has5Permutations(sortedN):
index = numberList[len(sortedN)].index(sortedN)
print((sum([len(numberList[j]) for j in range(len(sortedN)) ]) + index+1) ** 3)
exit(0)
i += 1