Erdős-primes: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) (Added Arturo implementation) |
|||
Line 15: | Line 15: | ||
:* the OEIS entry: [http://oeis.org/A064152 A064152 Erdos primes]. |
:* the OEIS entry: [http://oeis.org/A064152 A064152 Erdos primes]. |
||
<br><br> |
<br><br> |
||
=={{header|Arturo}}== |
|||
<lang rebol>factorials: map 1..20 => [product 1..&] |
|||
erdos?: function [x][ |
|||
if not? prime? x -> return false |
|||
loop factorials 'f [ |
|||
if f >= x -> break |
|||
if prime? x - f -> return false |
|||
] |
|||
return true |
|||
] |
|||
loop split.every:10 select 2..2500 => erdos? 'a -> |
|||
print map a => [pad to :string & 5]</lang> |
|||
{{out}} |
|||
<pre> 2 101 211 367 409 419 461 557 673 709 |
|||
769 937 967 1009 1201 1259 1709 1831 1889 2141 |
|||
2221 2309 2351 2411 2437</pre> |
|||
=={{header|AWK}}== |
=={{header|AWK}}== |
||
Line 62: | Line 84: | ||
Erdos prime 7875: 999721 |
Erdos prime 7875: 999721 |
||
</pre> |
</pre> |
||
=={{header|C++}}== |
=={{header|C++}}== |
||
{{libheader|Primesieve}} |
{{libheader|Primesieve}} |