What does the Riemann zeta function have to do with the distribution of the primes?
Pangram verdict · v3.3
We believe that this document is fully human-written
AI likelihood · overall
HumanArticle text · 1,390 words · 8 segments analyzed
← back
February 13, 2026
One of the oldest theorems in mathematics is that there are infinitely many primes. Euclid (the geometer!) proved this around 300 BCE, and for centuries afterwards the story ended there. There are infinitely many primes -- so what else is there to ask about them?
However, some infinite sets are more `common' than others. For example, even numbers are pretty common, but powers of 2 are pretty rare: between \(1\) and \(1000,\) there are 500 even numbers, but only ten powers of 2. Thus, an interesting follow up question to Euclid's proof is to ask: can we quantify how common prime numbers are?
One way of expressing the idea of that there are more even numbers than powers of 2 is to note that \[\frac{1}{2} + \frac{1}{4} + \frac{1}{6} + \frac{1}{8} + \frac{1}{10} + \cdots = \infty,\] but \[\frac{1}{2} + \frac{1}{2^2} + \frac{1}{2^3} + \frac{1}{2^4} + \frac{1}{2^5} + \cdots = 1.\]
In other words, the powers of 2 are so far apart that when we replace \(2^n\) with \(\frac{1}{2^n}\) (turning a large number into a small number), we get a finite sum. But the even numbers are so close together that, even though you're adding terms which are getting smaller and smaller, you have so many terms that the final sum is infinity.
Euler was interested in the corresponding question for primes: is \[\frac{1}{2} + \frac{1}{3} + \frac{1}{5} + \frac{1}{7} + \frac{1}{11} + \frac{1}{13} + \cdots,\] the sum of the reciprocals of all the primes, infinite or finite?
Enter: the Riemann zeta function
To compute the infinite sum \[\frac{1}{2} + \frac{1}{3} + \frac{1}{5} + \frac{1}{7}+ \cdots = \sum_{p\text{ prime}} \frac{1}{p},\] Euler started with what is now called the Riemann zeta function (Riemann enters our story much later... but so many things in math are named after Euler, that we named this object after Riemann despite Euler being the first to discover it).
The Riemann zeta function is the infinite sum \[ \zeta(s)=1+\frac1{2^s}+\frac1{3^s}+\frac1{4^s}+\frac{1}{5^s} + \cdots = \sum_{n=1}^{\infty} \frac{1}{n^s}. \] Euler observed that this infinite sum actually factors as a sum involving primes.
For example, consider the product \[ \bigg(1+\frac1{2^s}+\frac1{4^s}+\cdots\bigg)\bigg(1+\frac1{3^s}+\frac1{9^s}+\cdots\bigg)\bigg(1+\frac1{5^s}+\frac1{25^s}+\cdots\bigg).\] When we distribute out the terms in this sum, we will get terms like \[1 \cdot 1 \cdot 1=1,\ \ \frac{1}{2^s} \cdot 1 \cdot 1=\frac1{2^s},\ \ \frac{1}{2^s} \cdot \frac{1}{3^s} \cdot 1 = \frac{1}{6^s},\ \ \frac{1}{4^s} \cdot \frac{1}{9^s} \cdot \frac{1}{5^s} = \frac{1}{180^s},\] as well as many more. Indeed, when we expand this sum out, we're going to get fractions whose denominators are any number which can be built out of 2, 3, and 5.
For example, if we wanted to find the term \(1/75^s\) in the infinite product, we would compute the prime factorization \(75=3\cdot25\) and realize that \[ \frac1{75^s}=1\cdot\frac1{3^s}\cdot\frac1{25^s} \] appears in the expansion.
Because every number admits a unique prime factorization, and can be built out of prime numbers in a unique way, Euler realized that if we took the infinite product \[ \bigg(1+\frac1{2^s}+\frac1{4^s}+\cdots\bigg)\bigg(1+\frac1{3^s}+\frac1{9^s}+\cdots\bigg)\bigg(1+\frac1{5^s}+\frac1{25^s}+\cdots\bigg) \cdots = \prod_{p\text{ prime}} \left(1 + \frac{1}{p^s} + \frac{1}{(p^2)^s} + \frac{1}{(p^3)^s} + \cdots\right),\] then this infinite product would contain every term \(1/n^s\) exactly once after we distributed it out.
This leads to the Euler product formula: \[\frac{1}{1^s} + \frac{1}{2^s} + \frac{1}{3^s} + \frac{1}{4^s} + \cdots = \bigg(1+\frac1{2^s}+\frac1{4^s}+\cdots\bigg)\bigg(1+\frac1{3^s}+\frac1{9^s}+\cdots\bigg)\bigg(1+\frac1{5^s}+\frac1{25^s}+\cdots\bigg) \cdots,\] or
\[\sum_{n=1}^{\infty} \frac{1}{n^s} = \prod_{p\text{ prime}} \left(1 + \frac{1}{p^s} + \frac{1}{(p^2)^s} + \frac{1}{(p^3)^s} + \cdots\right).\]
Each of the sums \[1 + \frac{1}{p^s} + \frac{1}{p^{2s}} + \frac{1}{p^{3s}} + \cdots\] is what is known as a geometric series. Geometric series can be summed very concretely: if we set \[X = 1 + \frac{1}{p^s} + \frac{1}{p^{2s}} + \cdots,\] then \[\frac{X}{p^s} = \frac{1}{p^s} + \frac{1}{p^{2s}} + \frac{1}{p^{3s}} + \cdots.\] Subtracting these two equations, \[X - \frac{X}{p^s} = 1,\] because all the terms on the right hand side except for the 1 cancel. Thus \[X \cdot \left(1 - \frac{1}{p^s}\right) = 1,\] so \[X = \frac{1}{1 - \frac{1}{p^s}}.\]
Thus, the Euler product formula can be written as \[\zeta(s)=\frac1{1-\frac1{2^s}}\cdot\frac1{1-\frac1{3^s}}\cdot\frac1{1-\frac1{5^s}}\cdots. \]
The Euler product formula is a way of encoding unique prime factorization in calculus, if you recall how its explanation required unique prime factorization. This is important because it is therefore a bridge between number theory and calculus; summing infinite series (like computing \(1/2 + 1/3 + 1/5 + 1/7 + \cdots,\) the sum of the reciprocals of the primes) is a calculus problem, but primes are number theoretic objects, so to solve our infinite sum over primes we need to use such a bridge.
Summing \(\frac{1}{2} + \frac{1}{3} + \frac{1}{5} + \cdots\)
But how do we actually cross our bridge, now that it exists? The right hand side of the Euler product formula involves an infinite product over all primes; but our problem is about a sum over the primes. As we saw in What is \(\log(3)\) modulo \(7\)?, logarithms are the standard tool to convert products into sums.
Thus, taking the logarithm in the Euler product formula, we get \[\log\zeta(s) = \log\left(\frac{1}{1 - \frac{1}{2^s}}\right) + \log\left(\frac{1}{1 - \frac{1}{3^s}}\right) + \log\left(\frac{1}{1 - \frac{1}{5^s}}\right) + \cdots = \sum_{p \text{ prime}} \log\left(\frac{1}{1-\frac{1}{p^s}}\right).\]
Unfortunately, these logarithms seem a little hard to use. However, we can use Taylor series to rewrite \[\log\left(\frac{1}{1 - x}\right) = x + \frac{x^2}{2} + \frac{x^3}{3} + \frac{x^4}{4} + \cdots,\] so that \[\log\left(\frac{1}{1 - \frac{1}{p^s}}\right) = \frac{1}{p^s} + \frac{1}{2p^{2s}} + \frac{1}{3p^{3s}} + \cdots.\]
Putting this all together, we find \[\log\zeta(s) = \sum_{p\text{ prime}} \frac{1}{p^s} + \sum_{p\text{ prime}} \frac{1}{2p^{2s}} + \sum_{p\text{ prime}} \frac{1}{3p^{3s}} + \cdots.\]
Set \(s = 1\) in the above expression.
Now, the left handside becomes \[\log\zeta(1) = \log\left(1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \cdots\right) = \log \infty = \infty,\] because the infinite sum \[1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \frac{1}{5} + \cdots\] is infinity. If you've never seen this fact before (called the divergence of the harmonic series), then you might find the following calculation of the sum amusing. We can regroup this infinite sum as \[ 1+\frac12+\bigg(\frac13+\frac14\bigg)+\bigg(\frac15+\frac16+\frac17+\frac18\bigg)+\cdots. \] In the first set of parentheses, the terms are \[ \frac13+\frac14>\frac14+\frac14=\frac12, \] and in the second set of parentheses, the terms are \[ \frac15+\frac16+\frac17+\frac18>\frac18+\frac18+\frac18+\frac18=\frac12, \] and so on: \[ \frac19+\frac1{10}+\frac1{11}+\frac1{12}+\frac1{13}+\frac1{14}+\frac1{15}+\frac1{16}>\frac1{16}+\frac1{16}+\frac1{16}+\frac1{16}+\frac1{16}+\frac1{16}+\frac1{16}+\frac1{16}=\frac12. \] Thus \[ 1+\frac12+\bigg(\frac13+\frac14\bigg)+\bigg(\frac15+\frac16+\frac17+\frac18\bigg)+\cdots>1+\frac12+\frac12+\frac12+\cdots = \infty, \] so our infinite sum must be infinite as well.
Anyways, back to our identity.
We have \[\log\zeta(1) = \sum_{p\text{ prime}} \frac{1}{p} + \sum_{p\text{ prime}}\frac{1}{2p^2} + \sum_{p\text{ prime}} \frac{1}{3p^3} + \cdots,\] and we know now that \(\log\zeta(1) = \infty.\) Thus \[\infty = \sum_{p\text{ prime}} \frac{1}{p} + \sum_{p\text{ prime}}\frac{1}{2p^2} + \sum_{p\text{ prime}} \frac{1}{3p^3} + \cdots.\]
Here, we have the sum we want, namely \(\sum_p \frac{1}{p},\) but also a bunch of terms we don't want, like \(\sum_p \frac{1}{2p^2}.\) But Euler noticed something here: \[ \begin{align*} \sum_p \frac{1}{2p^2} + \sum_p \frac{1}{3p^3} + \sum_p \frac{1}{4p^4} + \cdots &= \sum_p \left(\frac{1}{2p^2} + \frac{1}{3p^3} + \frac{1}{4p^4} + \cdots\right) \\ &< \sum_p \left(\frac{1}{p^2} + \frac{1}{p^3} + \frac{1}{p^4} + \cdots\right) \\ &= \sum_p \frac{1/p^2}{1 - 1/p} \\ &< \sum_p \frac{1}{p^2 - p} \\ &< \sum_{n=2}^{\infty} \frac{1}{n^2 - n} = 1. \end{align*} \]
In this summation, we started by observing that if we make each denominator smaller, then each fraction gets bigger; so, it only makes the sum bigger. Then, we used that the sum \(1/p^2 + 1/p^3 + 1/p^4 + \cdots\) is an example of a geometric series, so using a similar trick to the one we did before, we could compute those infinite sums exactly.
Finally, we got a sum of \(1/(p^2 - p)\) over all the primes; we replace this with a sum over all integers (which could only make the final value bigger), and then we can compute \[\sum_{n=2}^{\infty} \frac{1}{n^2 - n} = 1. \] This computation is an example of a telescoping series: \[\frac{1}{n^2 - n} = \frac{1}{n(n-1)} = \frac{1}{n-1} - \frac{1}{n}.\] So, \[\sum_{n=2}^{\infty} \frac{1}{n^2 - n} = \left(1 - \frac{1}{2}\right) + \left(\frac{1}{2} - \frac{1}{3}\right) + \left(\frac{1}{3} - \frac{1}{4}\right) + \cdots,\] and rearranging the parentheses we find \[\sum_{n=2}^{\infty} \frac{1}{n^2 - n} = 1 + \left(-\frac{1}{2} + \frac{1}{2}\right) + \left(-\frac{1}{3} + \frac{1}{3}\right) + \cdots,\] so that all the terms except the 1 cancel.
But the upshot is that we now know \[\sum_p \frac{1}{2p^2} + \sum_p \frac{1}{3p^3} + \sum_p \frac{1}{4p^4} + \cdots < 1.\] So, in our equation \[\sum_p \frac{1}{p} + \left(\sum_p \frac{1}{2p^2} + \sum_p \frac{1}{3p^3} + \sum_p \frac{1}{4p^4} + \cdots\right) = \infty,\] we find that \(\sum_p 1/p,\) plus something smaller than 1, gives \(\infty.\) The only way this could possibly be true is if \[\sum_p \frac{1}{p} = +\infty.\]
Finally, we have computed our sum!