18 "output_type": "execute_result"
40 "output_type": "execute_result"
62 "output_type": "execute_result"
66 "644.prime_factors.length"
71 "execution_count": 10,
82 "execution_count": 10,
84 "output_type": "execute_result"
88 "def k_prime_factors(n, k)\n",
89 " (n...(n+k)).all? {|i| i.prime_factors.length == k}\n",
106 "execution_count": 6,
108 "output_type": "execute_result"
112 "def sequence(&generator)\n",
113 " Enumerator.new do |yielder|\n",
116 " yielder.yield generator.call(n)\n",
125 "execution_count": 11,
133 "#<Enumerator: #<Enumerator::Generator:0x00557286d6e4c8>:each>"
136 "execution_count": 11,
138 "output_type": "execute_result"
142 "integers = sequence {|i| i}"
147 "execution_count": 14,
158 "execution_count": 14,
160 "output_type": "execute_result"
164 "integers.lazy.select {|i| k_prime_factors(i, 2)}.take(1).force"
169 "execution_count": 13,
180 "execution_count": 13,
182 "output_type": "execute_result"
186 "integers.lazy.select {|i| k_prime_factors(i, 3)}.take(1).force"
191 "execution_count": 15,
202 "execution_count": 15,
204 "output_type": "execute_result"
208 "integers.lazy.select {|i| k_prime_factors(i, 4)}.take(1).force"
213 "execution_count": null,
223 "display_name": "Ruby 2.4.0",
228 "file_extension": ".rb",
229 "mimetype": "application/x-ruby",