It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.
Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits.
%digit_split p52()-> put(six,lists:seq(1,6)), p52(1). p52(N)-> [First|Digs]=lists:map(fun(M)->lists:sort(digit_split(N*M)) end,get(six)), case lists:all(fun(X)->X==First end,Digs) of true-> io:format("~w~n",[N]); false->p52(N+1) end.
#dig_split def p52 x=0 while true x+=1 comp=dig_split(x).sort if (2..6).all?{|i|dig_split(x*i).sort==comp} puts x return end end end