Explore the Prime Staircase Woven by Zeros

Try adjusting the parameters yourself:

Primes Can Form a Staircase

Imagine a staircase stretching endlessly to the right. Whenever x reaches a prime or an integer power of a prime, the staircase jumps upward. The steps are not all the same height: each jump is the natural logarithm ln(p) of the corresponding prime.

The gray staircase in the graph above is the graph of the Chebyshev function ψ(x). It records the prime powers p, p², p³…: each time one appears, the staircase rises by ln(p).

For example, when x reaches 2, the staircase rises by ln(2); at 3, it rises by ln(3); and at 4 (that is, 2²), it rises by ln(2) again. So it records both primes and their powers.

The locations of primes do not look evenly spaced, so the staircase rises and falls irregularly. Yet it is not without a pattern: behind these jumps lies a smooth overall trend.

A Curious Idea: Can Waves Build a Staircase?

You may have seen how adding many smooth waves together can create a shape with sharp corners. The more waves you combine, the more detail the resulting curve can capture from the original shape.

In 1859, while studying the distribution of primes, the mathematician Bernhard Riemann discovered a profound connection between the zeros of the Riemann zeta function and primes. His explicit formula links the distribution of prime powers to these zeros; related formulas were later put on a rigorous footing by other mathematicians.

This means the prime staircase is not merely the result of isolated jumps. It can also be described by starting with a smooth main term and adding a series of oscillating terms contributed by the zeros of the zeta function.

Next, adjust the number of zeros yourself and watch how their waves gradually add up, revealing the outline of a staircase from a smooth curve.

Where Do These Waves Come From?

The answer is: from special zeros of a function called the Riemann zeta function. You do not need to understand this function or know complex numbers first. Just know that it has a sequence of special zeros, and mathematicians have discovered that these zeros are closely connected to the distribution of primes.

Each zero contributes a wave. The numbers 14.1347, 21.0220, 25.0109… listed on the page are the values associated with the first few zeros. Larger values usually correspond to faster oscillations.

For a little more detail: these zeros are complex numbers, usually written ρ = β + γi. The numbers listed on the page are the positive imaginary parts γ of the zeros, not the full zeros. The imaginary part determines the frequency of the wave; the real part β affects how the oscillating term scales as x grows.

In this demonstration, the program uses zeros whose real part is 1/2, placing them on the line in the complex plane where the real part equals 1/2. Each such zero contributes a real-valued wave together with its complex conjugate.

However, not all zeros of the zeta function are alike.

Some zeros have very orderly locations: they lie at -2, -4, -6, -8… These are called trivial zeros.

What truly fascinates mathematicians is another, more mysterious sequence of zeros: the nontrivial zeros.

They do not lie on the ordinary number line, but are distributed in a complex plane. The first nontrivial zero is approximately:

12+14.13i

Here, i is the imaginary unit. You do not need to understand complex numbers yet; just know that each such zero has a corresponding number that sets the rhythm of a wave's oscillation.

Why are they so important?

Because the Riemann hypothesis makes a remarkable claim: the real part of every nontrivial zero is exactly 12.

This claim may seem unrelated to primes, yet it could reveal hidden patterns in their distribution. We will return to this question shortly.

The page comes with the imaginary parts of the first 200 nontrivial zeros. These values were computed in advance; the browser does not calculate them when the page opens.

Watch the Staircase Take Shape

When the page opens, you will see a pink curve starting as a smooth curve. The program then adds the waves from the zeros one by one, gradually giving the curve the shape of the gray staircase.

With 0 zeros, the pink curve has no contributions from zeros. It consists of the smooth part and correction terms in the explicit formula, so it looks like a smooth curve, but it is not simply x/ln(x).

With 10 zeros, the curve begins to oscillate visibly, and the staircase's general outline starts to emerge.

With 50 zeros, more waves with different frequencies combine, and the pink curve usually comes closer to the overall shape of the gray staircase.

With 200 zeros, you can see richer detail. Keep in mind that this is still a finite-term approximation using only the first 200 zeros, not the full expression with infinitely many zeros.

The prime locations are not entered directly into the pink curve as individual jump points. Instead, the waves contributed by the zeros approximate the staircase. This is one of the most fascinating features of the explicit formula.

Why Are the Riemann Hypothesis and These Waves Connected?

Each wave has its own strength. Imagine a group of people pushing a curve together: some have a more noticeable effect, while others make a subtler difference. The locations of the zeros determine how these waves affect the final shape.

The Riemann hypothesis says that all these nontrivial zeros lie on the same special line in the complex plane. This line has real part 1/2.

If the hypothesis is true, it constrains how much these waves can grow. In other words, the prime staircase can still fluctuate, but it cannot stray too far from the smooth trend. You can observe these fluctuations in the graph's deviation view.

For a little more detail: the real part β of a zero affects the scale of its oscillating term as x grows, roughly through a factor of x^β; the imaginary part γ determines the frequency. The Riemann hypothesis says that the real part of every nontrivial zero is 1/2.

For the Chebyshev function ψ(x) shown here, the Riemann hypothesis implies that its deviation from the smooth main term x satisfies ψ(x) − x = O(√x · (ln x)²). Here, O means the growth of the deviation is bounded at the indicated order; it does not mean that the deviation always stays below a fixed number.

If a nontrivial zero had real part greater than 1/2, its oscillating term could grow faster than √x, conflicting with the error bound associated with the Riemann hypothesis.

The Riemann hypothesis has not yet been proved. Computers have verified that many nontrivial zeros lie on this line, but checking finitely many cases cannot replace a proof for all zeros.

Try It: Adjust the Graph Yourself

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

Number of zeros: how many zeros to use in the approximate curve (0 to 200). Set it to 0 to add no waves from nontrivial zeros; increase the number gradually to see how the waves combine.

Range: the maximum x shown on the horizontal axis (20 to 400). A larger range shows a region farther to the right. For the same range, increasing the number of zeros usually reveals more oscillating detail, but a finite-term approximation is still not the full formula.

View: 0 shows the ψ(x) staircase and its approximation; 1 subtracts the smooth main term x from both, showing only the deviations of the staircase and approximation; 2 adds the waves from the first 5 zeros to the deviation view, so you can see how they combine.

Animation: 1 adds the zeros one by one to build the curve gradually; 0 shows the result for the final settings all at once.

You can also drag the graph left or right with your mouse, or zoom with the scroll wheel. Zoom in near a staircase jump to see the pink curve oscillate and overshoot. This is somewhat like the Gibbs phenomenon that occurs when Fourier series approximate a discontinuous function. Also, the explicit formula takes the average of the values on either side of a jump, so the pink curve may not line up exactly with the top edge of the gray staircase.

Keep Exploring the World of Mathematics

From the geometric patterns in the Ulam spiral, to the overall growth described by the prime number theorem, to Euler's product connecting primes with the zeta function, we have gradually approached the structure behind the distribution of primes. Now the Riemann explicit formula shows us how the zeros of the zeta function contribute waves that help describe the distribution of prime powers.

If you have not read the earlier topics, continue with the Prime Number Theorem and Euler Product: How Are Primes Connected to All Integers?. The former looks at primes through their growth in quantity; the latter explains the connection between primes and the zeta function.

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

You can also browse more amazing mathematical graphics.

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 construct 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
↑