diff --git a/src/task62 - Cubic permutations.py b/src/task62 - Cubic permutations.py new file mode 100644 index 0000000..4dcd2fd --- /dev/null +++ b/src/task62 - Cubic permutations.py @@ -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 \ No newline at end of file