Segmented sieve + precomputed table · Runs in your browser via WASM
Loading WASM…Loading table…
Sieving…
Quick examples
How it works
Precomputed table (pi.dat, 521 KB) — stores cumulative prime counts at every 30,000,000 interval up to 2×10¹².
Binary search — locates which 30M-wide block contains the nth prime. O(log 66667) = ~17 comparisons.
Sub-block segmented sieve — runs Eratosthenes in 2M chunks (odd-only) within that block. Small primes up to √(2×10¹²) ≈ 1.41M are precomputed once at startup.
Covers n from 1 to 73,301,931,359 (all primes up to 2 trillion). Typical query time: under 300ms in the browser.