Cubic special primes: Difference between revisions

m (syntax highlighting fixup automation)
Line 661:
</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}}==
<syntaxhighlight lang="ruby">func cubic_primes(callback) {
1,149

edits