16 "output_type": "execute_result"
20 "require_relative 'array-numbers'"
25 "execution_count": 52,
34 "execution_count": 52,
36 "output_type": "execute_result"
40 "cubes = Hash.new {|h, k| h[k] = []}\n",
42 "(100..1000).each do |i|\n",
44 " p = c.to_digits.sort.join\n",
45 " # cubes[p] = (cubes[p] + [c])\n",
47 " cube_roots[c] = i\n",
54 "execution_count": 53,
60 "{\"01234566\"=>[41063625, 56623104, 66430125]}"
63 "execution_count": 53,
65 "output_type": "execute_result"
69 "cubes.select {|k, v| v.length >= 3}"
74 "execution_count": 42,
83 "execution_count": 42,
85 "output_type": "execute_result"
89 "cube_roots[41063625]"
94 "execution_count": 58,
103 "execution_count": 58,
105 "output_type": "execute_result"
111 "cubes = Hash.new {|h, k| h[k] = []}\n",
112 "finished = false\n",
114 "while ! finished\n",
116 " p = c.to_digits.sort.join\n",
118 " if cubes[p].length == target\n",
119 " finished = true\n",
130 "execution_count": null,
140 "display_name": "Ruby 2.4.0",
145 "file_extension": ".rb",
146 "mimetype": "application/x-ruby",