Prime Sieve Animation

Watch the Sieve of Eratosthenes find prime numbers, animated.

An ancient algorithm in action

The Sieve of Eratosthenes is a beautifully simple method for finding all the primes up to a limit, over two thousand years old and still used. This animates it, so you can watch the primes emerge as the multiples are crossed out.

Set a limit and watch the sieve find the primes.

Elegance you can watch

The sieve works by elimination rather than testing: start with all the numbers, then repeatedly take the next number that has not been crossed out — which must be prime — and cross out all its multiples, since they cannot be prime. What remains at the end are the primes. Watching it run is genuinely satisfying, as the multiples of two, then three, then five fall away in cascading patterns, and the primes reveal themselves as the survivors. It is a perfect example of an algorithm that is both ancient and efficient, and of how a simple, mechanical rule can solve a problem that seems to require checking each number individually. Seeing the crossing-out happen makes the logic click far better than any description, which is exactly what makes the animation a lovely way to understand it.

Questions & answers

How does the Sieve of Eratosthenes work?

Repeatedly take the next uncrossed number, which must be prime, and cross out all its multiples. What survives at the end are the primes.

Why is watching it useful?

Seeing the multiples of two, then three, then five fall away makes the logic click far better than a description, and reveals the primes as the survivors.

Is anything uploaded?

No. The visualisation happens in your browser.

More Math tools