Cubic special primes: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
(→{{header|Ruby}}: Add Ruby) |
||
Line 661: | Line 661: | ||
</pre> |
</pre> |
||
=={{header|Ruby}}== |
|||
<syntaxhighlight lang="ruby">require 'prime' |
|||
res = [2] |
|||
until res.last > 15000 do |
|||
res << (1..).detect{|n| (res.last + n**3).prime? } ** 3 + res.last |
|||
end |
|||
puts res[..-2].join(" ") |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre>2 3 11 19 83 1811 2027 2243 2251 2467 2531 2539 3539 3547 4547 5059 10891 12619 13619 13627 13691 13907 14419 |
|||
</pre> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
<syntaxhighlight lang="ruby">func cubic_primes(callback) { |
<syntaxhighlight lang="ruby">func cubic_primes(callback) { |