You are on page 1of 2

Sieve of Eratosthenes : It is an algorithm to find the prime

numbers below a given integer "n". It was created by the


ancient Greek mathematician Eratosthenes (!"#$%& '().
*he steps are as follows:
$) (reate a table with all numbers from $ to + in ascending
order.
) (ross out $ since it is not prime.
,) (ircle because it is the smallest prime number. (ross
out every multiple of .
&) (ircle the ne-t open number. ,. +ow cross out every
multiple of ,.
/) (ontinue this process until all numbers in the table have
been circled or crossed out. *he ones circled are the prime
numbers.
E-ample :
0et us use the Sieve of Eratosthenes to find all primes
numbers below " :
$ , & / " ! 1 % $2 $$ $ $, $& $/ $" $! $1 $% 2 $ ,
& / "
3irst we cross out $ ( instead of crossing out I will highlight
in red)
$ , & / " ! 1 % $2 $$ $ $, $& $/ $" $! $1 $% 2 $ ,
& / "
*hen circle ( instead of circling I will highlight in yellow)
and cross out each multiple of two
$ , & / " ! 1 % $2 $$ $ $, $& $/ $" $! $1 $% 2 $ ,
& / "
*hen circle , ( again I will highlight in yellow instead of
circling) and cross out ( highlight in red) any multiple of ,
$ , & / " ! 1 % $2 $$ $ $, $& $/ $" $! $1 $% 2 $ ,
& / "
+ow same procedure with /
$ , & / " ! 1 % $2 $$ $ $, $& $/ $" $! $1 $% 2 $ ,
& / "
+ow we do the same with ! and remaining numbers . which
all turn out to be primes
$ , & / " ! 1 % $2 $$ $ $, $& $/ $" $! $1 $% 2 $ ,
& / "
*herefore .,./.$$.$,.$!.$% and , are the prime numbers
below "

You might also like