Penta-power prime seeds: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) (added Arturo) |
(→{{header|Ruby}}: Add Ruby) |
||
Line 427: | Line 427: | ||
ten million is the 72nd: 10,347,035</pre> |
ten million is the 72nd: 10,347,035</pre> |
||
=={{header|Ruby}}== |
|||
<syntaxhighlight lang="ruby">require 'openssl' |
|||
pent_pow_primes = (1..).lazy.select{|n| (0..4).all?{|exp| OpenSSL::BN.new(n**exp + n + 1).prime?} } |
|||
n = 30 |
|||
puts "The first #{n} penta-power prime seeds:" |
|||
pent_pow_primes.take(n).each_slice(10){|s| puts "%8s"*s.size % s}</syntaxhighlight> |
|||
{{out}} |
|||
<pre>The first 30 penta-power prime seeds: |
|||
1 5 69 1665 2129 25739 29631 62321 77685 80535 |
|||
82655 126489 207285 211091 234359 256719 366675 407945 414099 628859 |
|||
644399 770531 781109 782781 923405 1121189 1158975 1483691 1490475 1512321 |
|||
</pre> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
{{libheader|Wren-gmp}} |
{{libheader|Wren-gmp}} |