primes IS OPERATION N {
V := count N;
(2 match BYROWS REDUCE plus (0 match (V OUTER MOD V))) sublist V
}
|
sieve IS OPERATION N {
R := sqrt N;
S := o hitch take (N - 1) l;
P := 0;
WHILE P <= R DO
P := P + 1 + find l (P drop S);
S := o (rest (P * count floor (N / P)) - 1) placeall S;
ENDWHILE;
S sublist count N
}
|