16 "execution_count": 15,
18 "output_type": "execute_result"
27 "execution_count": 10,
38 "execution_count": 10,
40 "output_type": "execute_result"
44 "125.to_s.each_char.map {|d| d.to_i ** 4}.sum"
49 "execution_count": 11,
60 "execution_count": 11,
62 "output_type": "execute_result"
66 "1634.to_s.each_char.map {|d| d.to_i ** 4}.sum"
71 "execution_count": 16,
82 "execution_count": 16,
84 "output_type": "execute_result"
88 "log10(5) + 5 * log10(9)"
93 "execution_count": 18,
100 "output_type": "stream",
102 "0: -Infinity =?= 1\n",
103 "1: 4.771212547196624 =?= 2\n",
104 "2: 5.0722425428606055 =?= 3\n",
105 "3: 5.248333801916287 =?= 4\n",
106 "4: 5.373272538524587 =?= 5\n",
107 "5: 5.470182551532643 =?= 6\n",
108 "6: 5.549363797580268 =?= 7\n",
109 "7: 5.616310587210881 =?= 8\n",
110 "8: 5.674302534188568 =?= 9\n",
111 "9: 5.7254550566359494 =?= 10\n"
120 "execution_count": 18,
122 "output_type": "execute_result"
127 " puts \"#{n}: #{log10(n) + 5 * log10(9)} =?= #{n+1}\"\n",
133 "execution_count": 19,
144 "execution_count": 19,
146 "output_type": "execute_result"
150 "def digit_power_sum(n, p)\n",
151 " n.to_s.each_char.map {|d| d.to_i ** p}.sum\n",
157 "execution_count": null,
168 "execution_count": 20,
179 "execution_count": 20,
181 "output_type": "execute_result"
185 "digit_power_sum(125, 4)"
190 "execution_count": 21,
201 "execution_count": 21,
203 "output_type": "execute_result"
207 "digit_power_sum(1634, 4)"
212 "execution_count": 23,
223 "execution_count": 23,
225 "output_type": "execute_result"
229 "(2..10000).select {|n| digit_power_sum(n, 4) == n}"
234 "execution_count": 32,
242 "[1, 4150, 4151, 54748, 92727, 93084, 194979]"
245 "execution_count": 32,
247 "output_type": "execute_result"
251 "(1..10**6).select {|n| digit_power_sum(n, 5) == n}"
256 "execution_count": 33,
264 "[1, 4150, 4151, 54748, 92727, 93084, 194979]"
267 "execution_count": 33,
269 "output_type": "execute_result"
273 "(1..10**7).select {|n| digit_power_sum(n, 5) == n}"
278 "execution_count": 34,
289 "execution_count": 34,
291 "output_type": "execute_result"
295 "(2..10**6).select {|n| digit_power_sum(n, 5) == n}.sum"
300 "execution_count": null,
310 "display_name": "Ruby 2.4.0",
315 "file_extension": ".rb",
316 "mimetype": "application/x-ruby",