A sum over all whole numbers equals a product over all primes. Build both sides, watch them agree, and see how one identity turns questions about primes into questions about a function
In 1737 Euler noticed that a sum over every whole number equals a product over every prime. That identity is a door between two worlds, adding and multiplying, analysis and arithmetic, and everything else in this module walks through it. Here you build both sides, run the proof, and work out what the product knows.
Press Play and watch a sum over whole numbers and a product over primes close in on the same value. Then switch to Euler’s sieve and multiply in one factor at a time until a single term is left.
Lime is a sum the browser has just added up, amber belongs to the primes, and sky blue is ζ(s) computed independently by the Euler–Maclaurin formula. The sieve is carried out on the first 200,000 coefficients of the series, of which the grid shows 120; the terms beyond are estimated from the proportion of numbers that survive, which is why the two readouts differ in their last digits once large primes are in play. Under each number is its term n−s. In the expansion, numbers are capped at 99,999.
The identity is ∑ n−s = ∏ (1 − p−s)−1, the sum over all whole numbers n ≥ 1 and the product over all primes p. Euler stated it in Variae observationes circa series infinitas, presented to the St Petersburg Academy in 1737, and his proof is the one the sieve view performs. Multiplying the sum by 2−s gives the sum over even numbers; subtract, and only the odd terms remain. Do the same with 3, then 5, and after every prime the only number with no prime factor is 1.
Read the other way, each factor is a geometric series, (1 − p−s)−1 = 1 + p−s + p−2s + …, and multiplying them all out produces one term for each way of choosing a power of every prime. That every n appears means every whole number is a product of primes; that it appears once means the factorisation is unique. So the identity is the fundamental theorem of arithmetic, rewritten as a statement about functions.
Shortly before, in 1734–35, Euler had solved the Basel problem: the sum of the reciprocals of the squares is π2/6. With the product, that becomes a statement about primes: ∏ (1 − p−2) = 6/π2, which the next demo turns into a probability.
Both sides make sense only for s > 1. At s = 1 the sum is the harmonic series and the product diverges with it. Euler worked with real s. Riemann’s step in 1859 was to let s be a complex number, s = σ + it, where the identity holds for σ > 1 by the same argument, and then to ask what the function does beyond that edge. See also: Continuing Past the Edge.
Step through the three views. Watch the sum of the reciprocals of the primes creep upwards, tap the lattice to see which points are visible from the origin, then see where treating primes as independent coins goes wrong.
Amber is counted exactly from primes the browser sieved; sky blue is a formula; lime is a seeded random sample or a point you chose. The sieve stops at 107, the sample at 2,000,000 tuples, and the ± is one standard error. The exact counts use Möbius inversion over the common factor, ∑ μ(d)⌊N/d⌋k. In the third view the primes are counted in ranges a quarter of a factor of ten wide, the prime number theorem’s prediction is the integral of 1/ln n over the range, and the coins’ prediction is the integral of ∏(1 − 1/p) over primes p ≤ √n.
As s falls to 1 the sum grows without limit, like 1/(s − 1). A product of finitely many factors would stay finite, so there are infinitely many primes. Euler went further in the same paper: taking logarithms, ln ζ(s) is ∑ p−s plus something that stays bounded, so the sum of the reciprocals of the primes diverges too. The primes are therefore more numerous than the squares, whose reciprocals add up to a finite number. Euler described the divergence as the logarithm of the logarithm of infinity.
Franz Mertens made that exact in 1874, with three theorems. For primes p ≤ x: ∑ (ln p)/p = ln x + O(1); ∑ 1/p = ln ln x + M + O(1/ln x), with M = 0.2614972128… now called the Meissel–Mertens constant; and ∏ (1 − 1/p) is asymptotic to e−γ/ln x, where γ = 0.5772… is Euler’s constant. These are theorems, proved by elementary means 22 years before the prime number theorem. The demo checks them against primes it sieves.
The chance that a prime p divides each of two random whole numbers is 1/p2. If different primes behave independently, the chance that no prime divides both is ∏ (1 − p−2) = 1/ζ(2) = 6/π2. Here the argument can be made rigorous, as a statement about the proportion of pairs up to N as N grows: Dirichlet proved it in 1849, and Cesàro gave it again in 1881–83. The same reasoning gives 1/ζ(k) for k numbers, and 6/π2 again for the density of squarefree numbers.
Applied to primes themselves, the same heuristic fails. A number near x is prime exactly when no prime up to √x divides it, and independent coins give that the probability ∏ (1 − 1/p), which by Mertens’ third theorem is about 2e−γ/ln x. The true density is 1/ln x, and 2e−γ ≈ 1.1229. The reason is that divisibility by a set of primes is exactly independent only over a stretch as long as their product, and the product of the primes up to √x is vastly larger than x. Primes behave randomly enough for some questions and not for others. How far they depart from random is what the zeros of zeta measure.
Choose a row of the dictionary and drag the point s around the half-plane to compare both sides. Then multiply two series, and slide the line at the bottom towards 1.2 to watch bumps grow at the heights of the zeros.
| Sequence a(n) | ∑ a(n) n−s equals | Series, 10,000 terms | Closed form at s | Apart by |
|---|---|---|---|---|
| the constant 1 | ζ(s) | 0.80423 + 0.00845i | 0.80425 + 0.00844i | 2.4 × 10⁻⁵ |
| Möbius | 1/ζ(s) | 1.24326 − 0.01304i | 1.24326 − 0.01304i | 2.2 × 10⁻⁷ |
| number of divisors | ζ(s)² | 0.64652 + 0.01369i | 0.64675 + 0.01357i | 2.5 × 10⁻⁴ |
| sum of divisors | ζ(s)·ζ(s − 1) | needs Re s > 2 | 0.54665 + 0.04976i | — |
| Euler’s totient | ζ(s − 1)/ζ(s) | needs Re s > 2 | 0.84647 + 0.05919i | — |
| squarefree indicator | ζ(s)/ζ(2s) | 0.77432 − 0.01992i | 0.77434 − 0.01992i | 1.5 × 10⁻⁵ |
| Liouville | ζ(2s)/ζ(s) | 1.29057 + 0.03321i | 1.29057 + 0.03321i | 2.4 × 10⁻⁷ |
| von Mangoldt | −ζ′(s)/ζ(s) | −0.13110 + 0.03765i | −0.13108 + 0.03764i | 2.4 × 10⁻⁵ |
The selected row is a(n). Choose b(n); the coefficients of the product series are sums over divisors.
| divisor d | 1 | 2 | 3 | 4 | 6 | 12 | sum |
|---|---|---|---|---|---|---|---|
| a(d) | 0 | 0.693 | 1.099 | 0.693 | 0 | 0 | |
| b(n/d) | 1 | 1 | 1 | 1 | 1 | 1 | |
| a(d) × b(n/d) | 0 | 0.693 | 1.099 | 0.693 | 0 | 0 | 2.485 |
Add up ∑ Λ(n) n−s along a vertical line to the right of 1 and plot its size against the height.
Amber is a sum over whole numbers or primes added up here, sky blue a value built from ζ, lime the product sequence, fuchsia a zero. ζ is computed by the Euler–Maclaurin formula and ζ′ by differentiating that formula term by term, with no finite differences; both are good to about eleven figures. Each series stops at 10,000 terms, and the teal figure is a proved bound on the rest from the growth of the sequence, so close to the red line the agreement is poor and the bound says so. The plane is coloured by the closed form on a 100 × 72 grid: hue is the argument, dark is near zero, bright is large. These are double-precision computations, not proofs.
A Dirichlet series is a sum ∑ a(n) n−s. Where a power series converges inside a disc, a Dirichlet series converges in a half-plane Re s > σc, and absolutely in a possibly smaller half-plane Re s > σa, with σa − σc at most 1. Dirichlet introduced them in 1837 to prove that every arithmetic progression a, a + q, a + 2q, … with a and q coprime contains infinitely many primes. Since m−s k−s = (mk)−s, the product of two such series has coefficients (a ∗ b)(n) = ∑ a(d) b(n/d), summed over the divisors d of n: multiplication of functions is convolution of sequences.
That one rule generates the table. ζ(s)2 has coefficients 1 ∗ 1 = d(n), the number of divisors. ζ(s)ζ(s − 1) has coefficients 1 ∗ n = σ(n). The inverse of ζ comes from expanding the Euler product, ∏ (1 − p−s) = ∑ μ(n) n−s, where μ(n) is (−1)k for a product of k distinct primes and 0 if a square divides n. So μ ∗ 1 is the sequence 1, 0, 0, …, and Möbius inversion, which recovers g from f = g ∗ 1 as g = f ∗ μ, is nothing more than division by ζ.
The last row matters most. The logarithm of the Euler product is ln ζ(s) = ∑ p−ks/k, summed over primes p and k ≥ 1, and differentiating gives −ζ′(s)/ζ(s) = ∑ Λ(n) n−s, where the von Mangoldt function Λ(n) is ln p when n is a power of p and 0 otherwise. The left side of that equation is a function of a complex variable, with a pole at every zero ρ of ζ and another at s = 1, where it behaves like 1/(s − 1). The right side is a list of primes. Every later lesson exploits this: the primes on one side are tied to the zeros and the pole on the other (See also: Primes from Zeros).
The dictionary also shows how the Riemann hypothesis can be restated. The series ∑ μ(n) n−s is proved to converge for Re s > 1. It converges for every Re s > ½ if and only if the Riemann hypothesis holds: 1/ζ has a pole at each zero of ζ, so a zero off the critical line would block the convergence, and the converse is a theorem too. Until the hypothesis was proved in November 2026, nobody could show that the series converges anywhere to the left of the line Re s = 1; now it is a theorem that it converges all the way to Re s = ½ (See also: The Hypothesis in Disguise, and What Is Actually Known). See also: Number Theory, for multiplicative functions and a first look at the zeta function.
Spot a mistake or have an idea?