Summarize primes: Difference between revisions
→{{header|ALGOL 68}}: Use ALGOL 68-primes
(→{{header|jq}}: tidy) |
(→{{header|ALGOL 68}}: Use ALGOL 68-primes) |
||
Line 10:
=={{header|ALGOL 68}}==
{{libheader|ALGOL 68-primes}}
<lang algol68>BEGIN # sum the primes below n and report the sums that are prime #
# sieve the primes to 999 #
[]BOOL
# sum the primes and test the sum #
INT prime sum := 0;
Line 26 ⟶ 21:
print( ( "prime prime", newline ) );
print( ( "count prime sum", newline ) );
FOR i TO
IF prime[ i ] THEN
# have another prime #
Line 54 ⟶ 49:
, whole( prime sum count, 0 )
, " prime sums of primes below "
, whole(
, newline
)
)
END</lang>
{{out}}
<pre>
|