[SIEVE(i:1..100):: | |
p,mp:integer; | |
SIEVE(i - 1)?p; | |
print!p; | |
mp := p; comment mp is a multiple of p; | |
*[m:integer; SIEVE(i - 1)?m → | |
*[m > mp → mp := mp + p]; | |
[m = mp → skip | |
||m < mp → SIEVE(i + 1)!m | |
] ] | |
||SIEVE(0)::print!2; n:integer; n := 3; | |
*[n < 10000 → SIEVE(1)!n; n := n + 2] | |
||SIEVE(101)::*[n:integer;SIEVE(100)?n → print!n] | |
||print::*[(i:0..101) n:integer; SIEVE(i)?n → ...] | |
] |