Erdős-primes: Difference between revisions

Line 1,543:
 
999,721 is the 7,875th Erdos prime.
</pre>
 
=={{header|Ring}}==
<syntaxhighlight lang="ring">
load "stdlibcore.ring"
row = 0
limit = 2500
 
for p = 1 to limit
flag = 1
if isprime(p)
for k = 1 to p
if factorial(k) < p
temp = p - factorial(k)
if not isprime(temp)
flag = 1
else
flag = 0
exit
ok
else
exit
ok
next
else
flag = 0
ok
if flag = 1
row++
see "" + p + " "
if row % 5 = 0
see nl
ok
ok
next
 
see nl + "Found " + row + " Erdos primes less than 2500"
</syntaxhighlight>
{{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
 
Found 25 Erdos primes less than 2500
</pre>
 
2,468

edits