Erdős-primes: Difference between revisions

m
(Added C)
m (→‎{{header|Raku}}: Alternate)
Line 1,255:
 
The 7,875th Erdős prime is: 999,721</pre>
 
Alternately, using fewer hard coded values:
 
 
<syntaxhighlight lang="raku" line>use Lingua::EN::Numbers;
use List::Divvy;
 
my @factorial = 1, |[\*] 1..*;
my @Erdős = ^∞ .grep: { .is-prime and none($_ «-« @factorial.&upto: $_).is-prime }
 
put "Erdős primes < 2500:\n" ~ @Erdős.&before(2500)».&comma.batch(8)».fmt("%5s").join: "\n";
put "\nThe largest Erdős prime less than {comma 1e6.Int} is {comma .[*-1]} in {.&ordinal-digit} position."
given @Erdős.&before(1e6);</syntaxhighlight>
{{out}}
<pre>Erdős primes < 2500:
2 101 211 367 409 419 461 557
673 709 769 937 967 1,009 1,201 1,259
1,709 1,831 1,889 2,141 2,221 2,309 2,351 2,411
2,437
 
The largest Erdős prime less than 1,000,000 is 999,721 in 7875th position.</pre>
 
=={{header|REXX}}==
10,333

edits