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) & n != 2 then
                                go to ret;

                        for i := 3 step 2 until n % 2 do
                                if entier (n / i) * i = n then
                                        go to ret;
                        isprime := true;
                    ret:

                end;

                integer i;

                outstring (1, "first:\n");

                for i := 2 step 1 until NN do
                        if isprime (i) then
                                outinteger (1, i);
                outstring (1, "\ndone.\n")
        end;

        begin
                comment second algorithm (sieve) ;


                Boolean array arr [2 : NN];
                integer i, j;

                outstring (1, "second:\n");

                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
                                outinteger (1, i);
                outstring (1, "\ndone.\n")

        end
end
