Euler Product: How Do Primes Connect All Integers?

Try adjusting the parameters yourself:

How can two completely different paths lead to the same destination?

In our article on the Prime Number Theorem, we saw that although primes become less frequent, their numbers follow a describable pattern. This time, let's look at things from another angle: instead of counting primes, we'll try to use only primes to build a mathematical expression for all integers.

Imagine two people starting from different places and calculating in completely different ways.

The first person works with every positive integer: 1, 2, 3, 4… But instead of adding them directly, they turn each integer into a reciprocal power and add all those values together.

The second person focuses only on primes: 2, 3, 5, 7… For each prime, they calculate a special factor, then multiply all the factors together.

In the 18th century, mathematician Euler discovered that these two seemingly unrelated calculations lead to exactly the same result. This became known as the Euler product formula, an important starting point for understanding the relationship between the Riemann zeta function and primes.

The first path: adding over all integers

How does the sum work? Choose an exponent s greater than 1. Turn each positive integer n into its reciprocal power, 1/nˢ, then add all the terms:

1 + 1/2ˢ + 1/3ˢ + 1/4ˢ + ……

This infinite series is one way to express the Riemann zeta function when s is greater than 1. It is usually written as ζ(s).

For example, when s = 2, we get:

1 + 1/4 + 1/9 + 1/16 + ……

As we keep adding these terms, the result gets closer and closer to 1.644934…….

This number is no accident. In 1735, Euler proved that it is exactly π²/6. Mathematicians of the time were astonished that pi appeared in an infinite series made from the reciprocal squares of integers.

The second path: multiplying factors associated with primes

The second person's approach is completely different. Instead of handling every integer one by one, they focus only on primes.

For each prime p, calculate a factor: 1 ÷ (1 − 1/pˢ), then multiply together the factors for all primes.

Again, take s = 2:

The factor for prime 2 is 1/(1 − 1/4), or 4/3; for prime 3 it is 9/8; for prime 5 it is 25/24…

4/3 × 9/8 × 25/24 × 49/48 × ……

Each factor is a little larger than 1, and the factors get closer to 1 as the primes get larger.

When s is greater than 1, multiplying the factors for all primes in turn gives an infinite product that converges to a definite number. Surprisingly, it is exactly the same result as the first path.

Why are they equal?

The key is that each prime factor can be expanded into an infinite series.

For example, the factor for prime 2 expands to:

1 + 1/2ˢ + 1/4ˢ + 1/8ˢ + ……

The factor for prime 3 expands to:

1 + 1/3ˢ + 1/9ˢ + 1/27ˢ + ……

Multiplying all these parentheses together is like choosing one term from each set of parentheses and multiplying the chosen terms.

For instance, choose 1/2ˢ, 1/3ˢ, and 1/5ˢ from the parentheses for primes 2, 3, and 5. Their product is:

1/2ˢ × 1/3ˢ × 1/5ˢ = 1/30ˢ

Why does this produce the reciprocal powers of all positive integers? Because every positive integer greater than 1 can be written uniquely as a product of primes.

For example, 12 = 2 × 2 × 3, while 30 = 2 × 3 × 5. Each integer has a unique prime factorization; no different combination of primes gives the same integer. This important rule is called the fundamental theorem of arithmetic.

So when we expand the parentheses for all primes, 1/12ˢ appears exactly once, and 1/30ˢ appears exactly once. The reciprocal power for every positive integer appears once and only once.

That means multiplying all the prime factors and expanding the result gives exactly the sum of the reciprocal powers of all positive integers.

Primes are the building blocks of integers, and every integer has a unique construction. The Euler product formula turns this unique factorization into a beautiful equation.

Watch the graph: two curves approach the same destination

The blue curve on the page shows the first person's calculation: starting at 1, they add the reciprocal power for each integer one term at a time.

The orange curve shows the second person's calculation: starting with prime 2, they multiply in the factor for each new prime they encounter.

Both eventually approach the same gray dashed line, their shared destination: the value known in mathematics as ζ(s).

You'll notice that the orange curve usually gets close to the final value sooner than the blue curve. That's because a factor for one prime already includes the contributions from all positive powers of that prime.

In other words, the blue curve handles integers one by one, while the orange curve uses prime-power expansions to organize the contributions of many integers at once.

Which one gets there faster?

Switch the view to “Error.” Both axes then use a logarithmic scale, increasing by a factor of ten at each step. The graph shows how far each calculation is from the final value.

Both lines move downward, which means the error keeps shrinking. The orange curve is usually below the blue one, showing that with the truncation used in this demonstration, the prime product is closer to the final value.

For s = 2 and N = 100000, for example, summing only up to 100000 gives an error of about 0.00001. Using only prime factors up to 100000 gives an error of about 0.0000013.

Now consider how many numbers each calculation uses: from 1 to 100000 there are 100000 positive integers, but only 9592 primes.

So in this example, the Euler product needs to consider just 9592 prime factors to get very close to the final value.

This does not mean that each prime factor involves only one simple calculation. Each factor can itself be expanded into infinitely many power terms. The graph compares how the two mathematical expressions converge when truncated; it does not mean that multiplication is always faster than addition in an actual computation.

Primes are only part of the integers, yet their factors capture the contributions of every integer.

What happens when s = 1?

The Euler product formula is defined when s is greater than 1. So what happens if we try s = 1?

The sum over integers becomes:

1 + 1/2 + 1/3 + 1/4 + ……

This series is called the harmonic series. Although each term gets smaller and smaller, their sum can still exceed any number you choose. In mathematics, we say that the series diverges.

Euler also used this fact to give a proof that there are infinitely many primes.

Let's reason in reverse. Suppose there were only finitely many primes, p₁, p₂, …, pₖ.

By the fundamental theorem of arithmetic, every positive integer could be built only from these finitely many primes. So we could reorganize the sum of the reciprocals of all positive integers as this product:

(1 + 1/p₁ + 1/p₁² + …… ) × (1 + 1/p₂ + 1/p₂² + …… ) × ……

Each parenthesis is a geometric series. For example, the first sums to 1/(1 − 1/p₁), a finite number.

Since we assumed there were only finitely many primes, there would also be only finitely many parentheses. A product of finitely many finite numbers is still finite.

But the sum of the reciprocals of all positive integers is the harmonic series we just saw, and it diverges. It cannot equal a finite number.

A contradiction! Therefore, there cannot be only finitely many primes. There must be infinitely many primes.

One detail matters here: the Euler product as a standard infinite-product formula holds when s is greater than 1. This proof does not simply substitute s = 1 into the formula. Instead, it assumes there are finitely many primes, uses the fundamental theorem of arithmetic to construct a finite product, and reaches a contradiction with the divergence of the harmonic series.

How is this related to the Riemann Hypothesis?

So far, we have discussed ordinary real values of s greater than 1. In this range, both the sum of reciprocal powers of integers and the infinite product over primes converge to a definite number.

The Euler product formula has another important meaning: it shows that ζ(s) can be expressed not only through all positive integers, but also through all primes. This creates a direct link between primes and the zeta function.

In 1859, mathematician Riemann took a key step. He extended the zeta function from the real numbers to the complex numbers and used analytic continuation to study its properties across a much larger part of the complex plane.

There is an important distinction: the Euler product formula itself converges for complex s only when the real part of s is greater than 1. Riemann's zeta function can be defined over a larger region through analytic continuation. The Euler product cannot be treated as an equation that holds across the entire complex plane.

The Euler product also tells us that ζ(s) is not zero in the region where the real part is greater than 1, because the product converges there to a nonzero value.

So where are the zeros of the zeta function?

The zeta function has a group of relatively easy-to-describe zeros at −2, −4, −6, and so on. These are called the trivial zeros.

What truly fascinates mathematicians is another group of zeros. They lie in the part of the complex plane where the real part is between 0 and 1, a region called the critical strip.

The Riemann Hypothesis says that all these nontrivial zeros lie exactly on the vertical line through the center of the critical strip, where the real part is 1/2.

Why are these zeros so important? Their locations are deeply connected to how primes are distributed. By studying the zeros of the zeta function, mathematicians can better understand the details behind the growth in the number of primes and the fluctuations from their average pattern.

The fluctuations you saw in “Prime Steps Woven by Zeros” offer an intuitive picture of this connection.

The Riemann Hypothesis has not yet been proved.

Try it yourself: adjust the graph

Click “Next” below the graph to switch between views. You can also change the parameters below and click “Try”:

Exponent s: Enter a value from 1 to 10, including decimals. Larger values of s usually make the series and product converge faster, so you'll see them approach the final value sooner. Try s = 3: the destination is about 1.2020569, a number called Apéry's constant. In 1978, mathematician Roger Apéry proved that it is irrational.

Steps N: Choose how far the calculation goes, from 20 to 1000000. For the sum, this is the largest positive integer included; for the product, it is the largest allowed prime factor.

View: 0 shows the values themselves; 1 shows the error, with logarithmic axes that make it easier to see how both calculations approach the final value.

Animation: 1 draws the graph gradually from left to right, while 0 draws it all at once.

You can also drag left or right with your mouse and zoom with the scroll wheel. Zoom all the way to the left to see the orange curve jump to a new value whenever it encounters another prime factor.

From the Euler product to the Riemann Hypothesis

Euler discovered that an infinite product over primes can reconstruct the sum of reciprocal powers of all positive integers. This connection ties primes closely to the Riemann zeta function and opened a new door to studying the distribution of primes.

What information is hidden in the zeros of the zeta function? How do they affect the distribution of primes?

Continue with Prime Steps Woven by Zeros to see how seemingly distant complex zeros connect to primes on the number line.

If you enjoy patterns generated by mathematical rules, explore other mathematical works such as the Julia set, the Mandelbrot set, and the Newton fractal.

You can also browse more fascinating mathematical images, or read the Wikipedia introduction to the Euler product.

Further reading

  • Ulam prime spiral A geometric view: why do primes form diagonal lines?
  • Prime Number Theorem A statistical view: how does the number of primes grow?
  • Euler product An algebraic view: how can primes build the sum of reciprocal powers of all integers?
  • Zeros at Work A complex analysis view: how do the zeros of the zeta function affect the distribution of primes?

Want to see these stunning mathematical visuals every time you open a new tab? Install the Chrome extension now and set "Science Wonder Box" as your new tab page.🚀

Learn More
↑