Sieve of Eratosthenes
The Sieve of Eratosthenes is the oldest way to list primes: write the numbers from 2 up, then repeatedly take the next uncrossed number as a prime and cross out all its multiples. This animation lays the numbers in a grid and strikes out each prime’s multiples in its own colour, so the primes are exactly the cells left standing. Step through it prime by prime or let it run, and change the grid width to expose the diagonal stripes the multiples make.
Runs 100% in your browser — simulations are computed locally on your device.
Read the full guide to this tool
Notes
- Every composite is crossed as a multiple of some prime, so the survivors are precisely the primes.
- You can stop once the current prime exceeds √N — anything still uncrossed past that point is prime.
- The grid width controls which multiples fall on neat diagonals, a hint of the patterns behind prime spirals.
- Runs 100% in your browser — simulations are computed locally on your device.