Prime Sieve & Ulam Spiral

Watch the Sieve of Eratosthenes eliminate composites, or see primes on an Ulam spiral.

Loading interactive simulation...

The Riemann Hypothesis 🖖

The precise distribution of primes is controlled by the zeros of the Riemann zeta function ζ(s). All 10¹³ known non-trivial zeros lie on the critical line Re(s) = 1/2. Proving this for all zeros would give the sharpest possible prime-counting bounds — and win a $1 million Millennium Prize. As of 2025, it is unproved.

Sieving instead of testing 🖖

The Sieve of Eratosthenes finds primes by elimination rather than by testing each number. Start at 2, cross out every multiple, jump to the next surviving number, and repeat; whatever is never crossed out is prime. The clever shortcut: to sieve all numbers up to n, you only need to remove multiples of primes up to √n. So sieving everything below 100 requires crossing out multiples of just 2, 3, 5 and 7.

Ulam's bored doodle 🖖

In 1963 the mathematician Stanisław Ulam, bored during a talk, scribbled the integers in a square spiral and shaded the primes — and startlingly clear diagonal streaks appeared. Those diagonals trace prime-rich quadratics like Euler's n² + n + 41, which yields a prime for every n from 0 to 39. Why certain diagonals stay so dense is still not fully understood, which is why the pattern keeps fascinating number theorists.

Example problems