Piprimes: Difference between revisions
Content added Content deleted
(→{{header|jq}}: <pre>) |
(Added solution for Action!) |
||
Line 11: | Line 11: | ||
:* the OEIS entry: [http://oeis.org/A000720 A0000720 pi(n), the number of primes <= n. Sometimes called PrimePi(n)...]. |
:* the OEIS entry: [http://oeis.org/A000720 A0000720 pi(n), the number of primes <= n. Sometimes called PrimePi(n)...]. |
||
<br><br> |
<br><br> |
||
=={{header|Action!}}== |
|||
{{libheader|Action! Sieve of Eratosthenes}} |
|||
<lang Action!>INCLUDE "H6:SIEVE.ACT" |
|||
PROC Main() |
|||
DEFINE MAX="100" |
|||
BYTE ARRAY primes(MAX+1) |
|||
INT n=[0],p=[1] |
|||
Put(125) PutE() ;clear the screen |
|||
Sieve(primes,MAX+1) |
|||
WHILE n<22 |
|||
DO |
|||
PrintB(n) Put(32) |
|||
p==+1 |
|||
IF primes(p) THEN |
|||
n==+1 |
|||
FI |
|||
OD |
|||
RETURN</lang> |
|||
{{out}} |
|||
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Piprimes.png Screenshot from Atari 8-bit computer] |
|||
<pre> |
|||
0 1 2 2 3 3 4 4 4 4 5 5 6 6 6 6 7 7 8 8 8 8 9 9 9 9 9 9 10 10 11 11 11 11 11 11 12 12 12 12 13 13 14 14 |
|||
14 14 15 15 15 15 15 15 16 16 16 16 16 16 17 17 18 18 18 18 18 18 19 19 19 19 20 20 21 21 21 21 21 21 |
|||
</pre> |
|||
=={{header|ALGOL 68}}== |
=={{header|ALGOL 68}}== |