Sieve of Eratosthenes

The Sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to a given limit. It works by iteratively marking the multiples of each prime number as composite.

Algorithm: Start with 2, mark all its multiples as composite, then move to the next unmarked number and repeat.

Unprocessed
Prime
Composite

Controls

Press Spacebar or click Next Step to eliminate multiples of 2