Prime words: Difference between revisions

→‎{{header|ALGOL 68}}: Use ALGOL 68-primes
m (→‎{{header|Phix}}: use unix_dict())
(→‎{{header|ALGOL 68}}: Use ALGOL 68-primes)
Line 24:
<br><br>
=={{header|ALGOL 68}}==
{{libheader|ALGOL 68-primes}}
Does not distinguish between letters and non-letter ASCII codes (as with the REXX sample).
<lang algol68># find words whose character codes are primes #
Line 45 ⟶ 46:
END
);
# construct a sieve of primes up to the maximum character #
PR read "primes.incl.a68" PR
[ 0 : max abs char ]BOOL s;
FOR i TO UPB[]BOOL s DO= s[PRIMESIEVE i ] :=max TRUEabs ODchar;
s[ 0 ] := s[ 1 ] := FALSE;
FOR i FROM 2 TO ENTIER sqrt( UPB s ) DO
IF s[ i ] THEN FOR p FROM i * i BY i TO UPB s DO s[ p ] := FALSE OD FI
OD;
# find the prime words #
INT prime count := 0;
Line 106 ⟶ 103:
36: q
</pre>
 
=={{header|Arturo}}==
 
3,028

edits