My Adventures in Math and Technology
© Daniel Marvin.
Sieves are quick ways to yield primes, or other numbers, based on some rule of cancellation.
function sieve(N::Int) U = ones(N) U[1] = 0 for p in 2:div(N,2) if U[p] == 1 for m in 2*p:p:N U[m] = 0 end end end U end