Cubic special primes: Difference between revisions

Added solution for Action!
(Added solution for Action!)
Line 6:
where     '''n'''   <   '''15000'''.
<br><br>
 
=={{header|Action!}}==
{{libheader|Action! Sieve of Eratosthenes}}
<lang Action!>INCLUDE "H6:SIEVE.ACT"
 
PROC Main()
DEFINE MAX="14999"
BYTE ARRAY primes(MAX+1)
INT i=[2],next,count=[1],n=[1]
 
Put(125) PutE() ;clear the screen
Sieve(primes,MAX+1)
PrintI(i)
DO
next=i+n*n*n
IF next>=MAX THEN
EXIT
FI
IF primes(next) THEN
n=1 i=next count==+1
Put(32) PrintI(i)
ELSE
n==+1
FI
OD
PrintF("%E%EThere are %I cubic special primes",count)
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Cubic_Special_Primes.png Screenshot from Atari 8-bit computer]
<pre>
2 3 11 19 83 1811 2027 2243 2251 2467 2531 2539 3539 3547 4547 5059 10891 12619 13619 13627 13691 13907 14419
 
There are 23 cubic special primes
</pre>
 
=={{header|ALGOL 68}}==
Anonymous user