# Euler Solution 62

### From ProgSoc Wiki

The cube, 41063625 (345^(3)), can be permuted to produce two other cubes: 56623104 (384^(3)) and 66430125 (405^(3)). 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.

# Solutions

## Python by Althalus

Runtime: 171 ms

For each number, get it's cube, convert it to a string, and sort the characters. If that cube's ordered set is already in our dictionary, add the original number to the list for that ordered set, otherwise start the list for that permutation. If the list has a length of 5, stop, print the cube of the smallest element.

from string import join cubes = {} count = 1 target = 5 while True: index = join(sorted(str(count**3))) try: cubes[index].append(count) if len(cubes[index]) >= target: print sorted(cubes[index])[0]**3 break except KeyError: cubes[index] = [count] count+=1