article

In mathematics, the Sieve of Eratosthenes is a simple, ancient algorithm for finding all prime numbers up to a specified integer. It is the predecessor to the modern Sieve of Atkin, which is faster but more complex. It was created by Eratosthenes, an ancient Greek mathematician. Wheel factorization is often applied on the list of integers to be checked for primality, before Sieve of Eratosthenes is used, to increase the speed.

Algorithm


  1. Write a list of numbers from 2 to the largest number you want to test for primality. Call this List A. (This is the list of squares on the left-hand-side of the picture.)
  2. Write the number 2, the first prime number, in another list for primes found. Call this List B. (This is the list on the right-hand-side of the picture.)
  3. Strike off 2 and all multiples of 2 from List A.
  4. The first remaining number in the list is a prime number. Write this number into List B.
  5. Strike off this number and all multiples of this number from List A. The crossing-off of multiples can be started at the square of the number, as lower multiples have already been crossed out in previous steps.
  6. Repeat steps 4 through 6 until no more numbers are left in List A.

References


Κοσκινον Ερατοσθενους or, The Sieve of Eratosthenes. Being an Account of His Method of Finding All the Prime Numbers, by the Rev. Samuel Horsley, F. R. S., Philosophical Transactions (1683-1775), Vol. 62. (1772), pp. 327-347.

For more advanced developments, see:

External links


Primality tests

Решето на Ератостен | Sedàs d'Eratòstenes | Eratosthenovo síto | Sieb des Eratosthenes | Criba de Eratóstenes | Crible d'Ératosthène | Crivello di Eratostene | הנפה של ארטוסתנס | ერატოსთენეს საცერი | Eratosteno rėtis | Zeef van Eratosthenes | エラトステネスの篩 | Sito Eratostenesa | Решето Эратосфена | Sieve of Eratosthenes | Eratostenovo sito | Eratostenovo sito | Eratostheneen seula | Eratosthenes såll | 埃拉托斯特尼筛法

 

This article is licensed under the GNU Free Documentation License. It uses material from the "Sieve of Eratosthenes".

Home Pageartsbusinesscomputersgameshealthhospitalshomekids & teensnewsphysiciansrecreationreferenceregionalscienceshoppingsocietysportsworld