begin comment CALCULATION OF THE PRIME NUMBERS BETWEEN 2 AND 200 ; integer NN; NN := 200; begin comment FIRST ALGORITHM (CHECK DIVISION IN A LOOP) ; boolean procedure ISPRIME (N); value N; integer N; begin boolean procedure EVEN (N); value N; integer N; EVEN := ENTIER (N / 2) * 2 = N; integer I; ISPRIME := false; if EVEN (N) and N notequal 2 then goto RET; for I := 3 step 2 until N 'DIV' 2 do if ENTIER (N / I) * I = N then goto RET; ISPRIME := true; RET: end; integer I; VPRINT ("FIRST:"); for I := 2 step 1 until NN do if ISPRIME (I) then OUTINTEGER (1, I); VPRINT ("\NDONE.") end; begin comment SECOND ALGORITHM (SIEVE) ; boolean array ARR [2 : NN]; integer I, J; VPRINT ("SECOND:"); for I := 2 step 1 until NN do ARR [I] := true; for I := 2 step 1 until NN 'DIV' 2 do for J := 2 * I step I until NN do ARR [J] := false; for I := 2 step 1 until NN do if ARR [I] then OUTINTEGER (1, I); VPRINT ("\NDONE.") end end