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.
%digit_split p62()-> p62(100). p62(Next)-> Cube=Next*Next*Next, C=lists:sort(digit_split(Cube)), Class=case get(C) of undefined->[]; L->L end, C2=[Cube|Class], if length(C2)==5->io:format("~w~n",[lists:last(Class)]); true-> put(C,C2), p62(Next+1) end.
#cubes #dig_split def p62 i=0 equ=Hash.new([]) while true c=cubes(i+=1) d=dig_split(c).sort equ[d]+=[c] if(equ[d].length==5) up=d.join("").to_i cc=c while(cc<=up) cc=cubes(i+=1) dd=dig_split(dc).sort equ[dd]+=cc end if equ[d].length==5 puts equ[d].sort.first return end return end end end