Primearium Lab · Live Mathematics

π is made of primes

What does the circle constant have to do with indivisible whole numbers? Multiply every odd prime, race infinite series, or look across a grid of trees — and π emerges from prime arithmetic alone.

Proven Euler, 1748

Build π by multiplying every odd prime

Take every odd prime p and divide it by the nearest multiple of 4. Multiply those fractions forever: the result is π / 4. Primes one above a multiple of 4 pull the product up; primes one below pull it down. Watch this infinite tug-of-war settle onto π.

π / 4 = ∏p > 2 pp − χ(p) = 3/4 · 5/4 · 7/8 · 11/12 · 13/12 · 17/16 · …
p ≡ 1 (mod 4): fraction p/(p−1) > 1 nudges estimate up p ≡ 3 (mod 4): fraction p/(p+1) < 1 nudges estimate down
Live product 4 × ∏
3.0000000
True π: 3.1415926…
Odd primes used
1
Latest factor
3 / 4
Distance |est − π|
0.141593
Leading digits locked
1

Honest convergence check: this product is mathematically proven to converge to π/4, yet its convergence is notoriously slow and oscillatory. Even multiplying all 78,497 odd primes below 1,000,000 locks in only about three or four digits of π — because the product is only conditionally convergent.

For mathematicians — exact statements, status & references
Proven Euler, 1734 / 1737

The Basel Race: every integer vs. only primes

Add the reciprocals of all squares: 1 + 1/4 + 1/9 + 1/16 + …. Euler proved in 1734 that this sum equals π²/6 ≈ 1.644934. Three years later he found a second road to the exact same number using only prime numbers. Race both roads side by side.

∑n≥1 1/n² = π² / 6 = ∏p 1 / (1 − p⁻²)
Basel Sum ∑ 1/n²
1.000000
Euler Prime Product ∏ 1/(1 − p⁻²)
1.333333
Exact Limit π² / 6
1.644934
ζ(2) · implies π = 3.141592…

Why do primes win the race? Expand each prime factor as a geometric series: 1/(1 − 1/p²) = 1 + 1/p² + 1/p⁴ + …. Multiplying them together automatically builds 1/n² for every integer whose prime factors are already in the product — including huge numbers like 2²⁰ — because every integer factors uniquely into primes!

For mathematicians — exact statements, status & references
Proven Cesàro 1881 · Sylvester 1883

6 / π²: the orchard of visible trees

Stand at the corner (0, 0) looking out across a grid of trees planted at every whole-number spot (a, b). You can see tree (a, b) only if no closer tree stands on your line of sight — which happens if and only if a and b share no common factor (gcd(a, b) = 1). Out of an infinite orchard, exactly 6/π² ≈ 60.79% of the trees are visible.

Hover, tap, or use arrow keys on the orchard to trace a tree's line of sight from (0, 0).

For mathematicians — exact statements, status & references
Proven Riemann, 1859

π stands at the mirror of the zeta function

Euler's prime product defines the Riemann zeta function ζ(s) = ∏ (1 − p⁻ˢ)⁻¹. In 1859, Bernhard Riemann extended ζ(s) across the entire complex plane and proved a breathtaking reflection symmetry across the vertical line Re(s) = ½ — and right in the middle of that mirror sits π, inherited from the Gaussian bell curve.

ζ(s) = 2s · πs−1 · sin(πs/2) · Γ(1−s) · ζ(1−s)
Λ(s) = π−s/2 · Γ(s/2) · ζ(s) = Λ(1−s)
Observed Conjecture OEIS A005042

Primes hiding in the digits of π

Now flip the question around: instead of primes building π, can we spot primes inside the decimal digits of π? Right now your browser computes π from scratch using BigInt (Machin's 1706 formula) and runs Miller-Rabin from primes.js on every prefix: 3, 31, 314, 3141, 31415, 314159…

Open question

Honest status: among the first 120 (and even 150) digits of π, only prefixes of length 1, 2, 6, and 38 are prime (OEIS A005042: 1, 2, 6, 38, 16208, …). Later entries such as the 16,208-digit prefix are probable primes found by dedicated searches by others, not computed live here. Whether π is a normal number — or whether infinitely many prime prefixes of π exist at all — remains an open problem.

For mathematicians — exact statements, status & references
Notation note Proven

Plot twist: π(x) is just a naming coincidence!

When mathematicians count how many primes are at most x, they write π(x). Is that the circle constant 3.14159… in disguise? Nope! It is simply the Greek letter p (for prime), standardized by Edmund Landau in 1909.

π ≈ 3.14159…

The circle constant (truly tied to primes)

Born from geometry (circumference ÷ diameter), yet miraculously built out of prime numbers in Euler's products, the coprime orchard, and Riemann's mirror.

π(x)

The prime-counting function (just the letter p)

Counts primes ≤ x. By the Prime Number Theorem (Proven, 1896), π(x) ≈ x / ln(x) — governed by Euler's number e, not by 3.14159…!

Live exact count from sieve π(1,000) = 168
Prime Number Theorem (x / ln x) x / ln(x) ≈ 144.8
Ratio π(x) / (x / ln x) → 1 1.160

Proven (Hadamard & de la Vallée Poussin, 1896): as x grows, π(x) / (x / ln x) approaches 1 — no 3.14159… required. Still, seeing both π and π(x) side by side is one of mathematics' favorite inside jokes.