Sieve of Eratosthenes

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:

    It’s like pushing marbles through a sieve. It means the sieve will never be the same again.
    —Before the 1972 Democratic Convention in Miami. As quoted in Crazy Salad, ch. 6, by Nora Ephron (1972)