data = Hash.new([])(1..1_000_000).each do |i|
digits = (i**3).to_s.split('').sort.join('')
data[digits] += [i]
end
data.select { |_k,v| v.length > 2 }
It finds the same smallest cube that Larry and Charlie do.
Interestingly, it also gives the cases with more than two rearrangements of the digits in the cube. The cube 101740954697838253 was the largest such in my test run, which is 466837^3. Its digits can be rearranged to make a total of 49 cubes, whose roots are:
[466837, 478684, 480376, 512452, 528043, 558799, 573589, 601252, 632866, 635839, 637549, 655735, 667237, 675226, 675415, 675658, 677182, 698929, 701812, 705412, 705829, 742567, 756802, 761095, 761101, 768061, 778792, 797683, 800566, 808507, 809683, 815587, 816373, 837169, 867034, 868363, 879484, 909061, 919777, 927907, 928762, 946501, 948232, 957901, 971134, 977527, 980062, 991654, 994084]