Cousin primes: Difference between revisions
→{{header|ALGOL 68}}: Use ALGOL 68-primes
(Added Swift solution) |
(→{{header|ALGOL 68}}: Use ALGOL 68-primes) |
||
Line 76:
=={{header|ALGOL 68}}==
{{libheader|ALGOL 68-primes}}
<lang algol68>BEGIN # find cousin primes - pairs of primes that differ by 4 #
# sieve the primes as required by the task #
[]BOOL
# returns text right padded to length, if it is shorter #
PROC right pad = ( STRING text, INT length )STRING:
Line 97 ⟶ 90:
# look through the primes for cousins #
INT p count := 0;
FOR i TO
IF prime[ i ] THEN
IF prime[ i + 4 ] THEN
|