Distinct power numbers
[2..5]*2 -> cartesian.map_2d {|a,b| a**b }.sort.uniq.sayAlternative solution:
2..5 ~X** 2..5 -> sort.uniq.sayOutput:
[4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125]Last updated
Was this helpful?
[2..5]*2 -> cartesian.map_2d {|a,b| a**b }.sort.uniq.sayAlternative solution:
2..5 ~X** 2..5 -> sort.uniq.say[4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125]Last updated
Was this helpful?