In this recipe, we will look at a prime number calculator called Eratosthenes Sieve. It is an old algorithm for finding prime numbers. The prime numbers are found by crossing out composite numbers. The sieve works as follows:
- Start with 2, a known prime. Strike out all the numbers that are multiples of 2.
- Start with the next unmarked number, which will be the next prime (since it is not divided by any prime before). Repeat the procedure of marking all the multiples.
- Repeat the procedure.
For more information, visit https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes.