All in Algorithms

The Sieve of Eratosthenes is a simple algorithm for finding all of the prime numbers up to a certain limit (or between two numbers).

If you wanted to find all the Prime numbers between 2 and 100 you could iterate from 2 to 100 and test if that number itself were a prime, but ain't no one got time for that.

Since a Prime number is only divisible by itself and 1, we can start from 2, and continually flag every multiple of that number up to n as false (not a prime). The next number would be 3, then we can mark every multiple of 3 to n as false.