Concatenate two primes is also prime: Difference between revisions

→‎{{header|ALGOL 68}}: Use new prime list operators from Algol 68-prime
(→‎{{header|ALGOL 68}}: Added libheader)
(→‎{{header|ALGOL 68}}: Use new prime list operators from Algol 68-prime)
Line 14:
[]BOOL prime = PRIMESIEVE max prime;
# construct a list of the primes up to the maximum low prime to consider #
[]INT 1low :prime = EXTRACTPRIMESUPTO max low prime ]INT lowFROMPRIMESIEVE prime;
INT low pos := 0;
FOR i WHILE low pos < UPB low prime DO IF prime[ i ] THEN low prime[ low pos +:= 1 ] := i FI OD;
# find the primes that can be concatenated to form another prime #
[ 1 : max prime ]BOOL concat prime; FOR i TO UPB concat prime DO concat prime[ i ] := FALSE OD;
3,025

edits