Special neighbor primes: Difference between revisions
→{{header|ALGOL 68}}: Use ALGOL 68-primes
Catskill549 (talk | contribs) (added AWK) |
(→{{header|ALGOL 68}}: Use ALGOL 68-primes) |
||
Line 8:
=={{header|ALGOL 68}}==
{{libheader|ALGOL 68-primes}}
<lang algol68>BEGIN # find adjacent primes p1, p2 such that p1 + p2 - 1 is also prime #
INT max prime = 100;
# sieve the primes to max prime * 2 #
PR read "primes.incl.a68" PR
# count the primes up to max prime #
INT p count := 0; FOR i TO max prime DO IF prime[ i ] THEN p count +:= 1 FI OD;
Line 53 ⟶ 49:
( 73 + 79 ) - 1 = 151
</pre>
=={{header|AWK}}==
<lang AWK>
|