| |||||||||
In mathematics, the sieve of Eratosthenes is a simple algorithm for finding all the prime numbers up to a specified integer.
Step 1. List the integers, starting with "2".
Step 2. Mark the first number in the list as prime.
Step 3. Step through the main list eliminating all multiples of the number just added to the list of known primes.
Step 4. If the largest number in the main list is less than the square of the largest number in the known prime list, mark all numbers in the main list as prime; otherwise, return to Step 2.
Κοσκινον Ερατοσθενους 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: