begin comment -- From the NASE A60 distribution -- 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) ∧ N ≠ 2 then goto RET; for I ≔ 3 step 2 until N ÷ 2 do if ENTIER (N / I) × I = N then goto RET; ISPRIME ≔ TRUE; RET: end; integer I; PRINTSLN (“FIRST:”); for I ≔ 2 step 1 until NN do if ISPRIME (I) then PRINTNLN (I); PRINTSLN (“DONE.”) end; begin comment second algorithm (sieve) ; boolean array ARR [2 : NN]; integer I, J; PRINTSLN (“SECOND:”); for I ≔ 2 step 1 until NN do ARR [I] ≔ TRUE; for I ≔ 2 step 1 until NN ÷ 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 PRINTNLN (I); PRINTSLN (“DONE.”) end end