In mathematics, the sieve of Eratosthenes (Greek: κόσκινον Ἐρατοσθένους), one of a number of prime number sieves, is a simple, ancient algorithm for finding all prime numbers up to any given limit. It does so by iteratively marking as composite (i.e. not prime) the multiples of each prime, starting with the multiples of 2.
The multiples of a given prime are generated starting from that prime, as a sequence of numbers with the same difference, equal to that prime, between consecutive numbers. This is the sieve's key distinction from using trial division to sequentially test each candidate number for divisibility by each prime.
The sieve of Eratosthenes is one of the most efficient ways to find all of the smaller primes (below 10 million or so). It is named after Eratosthenes of Cyrene, a Greek mathematician; although none of his works have survived, the sieve was described and attributed to Eratosthenes in the Introduction to Arithmetic by Nicomachus.
Read more about Sieve Of Eratosthenes: Algorithm Description, Example, Algorithm Complexity, Implementation, Arithmetic Progressions, Euler's Sieve
Famous quotes containing the word sieve:
“They went to sea in a Sieve, they did,
In a Sieve they went to sea:
In spite of all their friends could say,
On a winters morn, on a stormy day,”
—Edward Lear (18121888)