FIRSTFIVEHUNDREDPRIMES: begin;
    integer J, K, N, Q, R;
    integer array PRIME[1 : 500];
    P1: PRIME[1] := 2;
    N := 3;
    J := 1;
    P2: J := J + 1;
    PRIME[J] := N;
    P3: if J = 500 then goto P9;
    P4: N := N + 2;
    P5: K := 2;
    P6: Q := N mod PRIME[K];
    R := N - Q TIMES PRIME[K];
    if R = 0 then goto P4;
    P7: if Q NOTLESS PRIME[K] then goto P2;
    P8: K := K + 1;
    goto P6;
    P9: OUTSTRING(1, "First Five Hundred Primes\n");
    for J := 1 step 1 until 50 do
      begin;
        for K := 1 step 1 until 10 do
          begin;
            integer P;
            P := PRIME[J + 50 TIMES (K - 1)];
            if P < 1000 then OUTCHAR(1, "0", 1);
            if P < 100 then OUTCHAR(1, "0", 1);
            if P < 10 then OUTCHAR(1, "0", 1);
            OUTINTEGER(1, P);
        end K;
        OUTSTRING(1, "\n");
    end J;
end ;