Every positive integer up to N is rendered as a small cube. Composite numbers stay
dim and grey; primes light up in blue. As N grows, the primes visibly thin out —
exactly as the Prime Number Theorem predicts, with density near 1/ln(N).
Meanwhile the bars on the right track how often each even gap size
between consecutive primes has occurred so far, building a live histogram.
Even though primes become rarer on average, the largest known prime gaps grow far slower than the numbers themselves — and whether infinitely many twin primes exist remains one of the oldest unsolved problems in mathematics.
Every integer from 1 up to a chosen limit N is rendered as a cube in a 3D grid or Ulam spiral, with primes lit up in blue while a live histogram on the side tracks the sizes of the gaps between consecutive primes.
As N grows, primes visibly thin out in line with the Prime Number Theorem, and the gap histogram fills in — showing how small gaps dominate while larger ones become progressively rarer but never disappear.
Drag the Upper limit N slider to scrub through ranges of integers, switch between the wrapped grid and the diagonal-rich Ulam spiral, toggle twin-prime highlighting, or turn on auto-scan to watch the histogram grow on its own.
Stanisław Ulam discovered his famous spiral in 1963 while doodling during a boring conference talk, noticing primes lining up along diagonals almost by accident.