Thursday, July 19, 2012

What is the Sieve of Eratosthenes?

The Sieve of Eratosthenes decants composite numbers,
leaving behind the prime numbers.


A  prime number is a
positive integer, whose factors are 1 and the number itself. A prime number will
always allow only 2 factors.


Let's see how Eratosthenes's
sieve works:


We'll write rows with numbers from 1 to 10, 10
to 20,...90 to 100.


1   2   3   4   5   6   7   8   9 
 10


11 12 13 14 15 16 17 18 19
20


21 22 23 24 25 26 27 28 29
30


31 32 33 34 35 36 37 38 39
40


.................................................


91
92 93 94 95 96 97 98 99 100


Since 1 is not a prime, we'll
take 2 as the first even prime number and then we'll cross out each multiple of
2.


We'll take 3 as the next positive integer prime and
we'll cross out it's multiples. Some of the number are already crossed out, since they
were the multiples of the prime 2, also.


We'll take the
next number, namely 5 and we'll cross out the multiples of
5.


We'll continue to do that until we'll finish all the
numbers up to 100. The crossed out numbers are the multiples, the open numbers being the
primes. 

No comments:

Post a Comment

How is Anne's goal of wanting "to go on living even after my death" fulfilled in Anne Frank: The Diary of a Young Girl?I didn't get how it was...

I think you are right! I don't believe that many of the Jews who were herded into the concentration camps actually understood the eno...