Prime Number Sieve

Walk through Eratosthenes on a dense grid, or let the run finish in a single beat. You pick the ceiling, the pace, and whether you need a comma-separated list for homework or curiosity.

Sieve workspace

Set N, pick speed, then run.

Pace

Phase

Ready

Active p

Strikes

0

Primes

0

Waiting Active Prime Composite
Prime list and density

Odd facts primes pick up in a sieve

Multiples of small primes eat the board first, so the grid looks noisy early, then suddenly quiet near the end.

2 is the only even prime, so the first sweep removes half the board in spirit before you even feel the rhythm of larger steps.

When you raise N, the count of primes near N grows roughly like N divided by the natural log of N, which is why a run to 1000 feels generous while a run to 200 still teaches the pattern.

Three jobs this fits

SituationWhat you do hereWhat you walk away with
Lecture prepSet N to 60, run slow, point at the first few wavesA shared visual for why composites collapse in families
Homework checkMatch your upper bound, use instant, copy the listA comma-separated sequence you paste into a proof or table
Competition warm-upToggle fast mode with N near 240Quick recall of density without hand arithmetic

Paper, Python, or this tab

Hand sketches reward muscle memory. A short script rewards scale. This page rewards immediacy: you see the strike pattern without installing a kernel.

When you need symbolic crunching elsewhere on the site, the Scientific Calculator stays handy for follow-up arithmetic, while the Mathematical Constants Generator pairs well if you jump from primes into constants for estimates.

Reviewed March 2026. Processing stays in your browser tab; we do not store your N or your prime list.

Why stop at the square root?

Every composite n carries a factor pair. One factor is always at or below the square root of n, so once you have crossed multiples for every prime up to that root, no composite above survives.

The tool mirrors the classic loop: walk p from 2 upward while p squared still fits inside N. Each time p stays unmarked, you promote p, then strike p squared, p squared plus p, and so on.

The ceiling nobody likes talking about

We cap N at 1000 so phones stay smooth. Pushing higher belongs to segmented sieves or native code, not a tight DOM grid.

If you need primality for one giant integer, a sieve up to N is the wrong hammer. Use a dedicated primality test or factor tool instead. For a single-number check, the Prime Number Calculator route is usually calmer than filling this grid.

Animated mode uses timers, so switching tabs mid-run may feel jumpy. Instant mode avoids the choreography entirely.

Colour on a grid is not a theorem

The animation is pedagogy, not certification. Courses still ask for arguments about divisibility, not screenshots of a web board.

Use the output as a checksum after you reason by hand, or as a lecture prop while you narrate the logic aloud.

Density heuristics matter for intuition. The Mathematical Function Grapher helps when you pivot from counting primes to comparing smooth curves, because the sieve itself never draws π(x) against x.

Segmented sieves, wheels, and Atkin variants exist because memory and constant factors bite long before you exhaust mathematics. This page chooses a transparent trade-off: small N, obvious cells, zero server round trip.

If you export the list into another tool, keep the comma format or switch to newlines in your editor. The copy buffer is plain text on purpose so note-taking apps do not inject hidden markup.

Questions people ask mid-sieve

Short answers tied to how the board behaves.

Why does the animation start crossing at p squared instead of 2p?

Smaller multiples of p were already removed when you processed earlier primes. Starting at p squared avoids redundant work and matches the textbook sieve.

Does instant mode skip steps or compute differently?

Same algorithm, same order of strikes. Instant mode simply skips the delays between updates so the DOM settles once at the end.

Why is 1 never highlighted as prime?

One is a unit, not prime. The grid begins at 2 so the definition matches modern number theory and cryptography primers.

Is the copied list reliable for graded work?

The list mirrors the boolean table on screen. If you changed N after a run, hit clear grid and run again so the clipboard matches the fresh table.

What happens if I set N above 1000?

The input clamps to 1000 to protect performance. Larger values trim back before cells build.