The Sieve of Erastothenes

Math 5370c - Fall 2008

Helmut Knaust, Department of Mathematical Sciences, UTEP, El Paso TX 79968
hknaust@utep.edu
9/30/08

Sieve[n_]:=Table[n k+l,{k,0,n-1},{l,1,n}]
n=13;
ES=Sieve[n];Print[ES]

k=1;While[Prime[k]≤n,Print["Multiples of ",Prime[k], " are eliminated:"];Print[ES=MapAll[(If[IntegerQ[#/Prime[k]]&&#/Prime[k]≥2,#/.#->Style[#,White],#]&),ES]];k++]
Clear[ES];