The Prime Counting Function π(n)

Approximations:

Related:

Dream of a Formula

In this video it is presented the (informal) idea of a Riemann converter or Riemann harmonics:
Pasted image 20250716081301.png
Each non-trivial zero can be seen as a kind of oscillatory function, in such a way that:
Pasted image 20250716081633.png
That is, the prime counting function is approximately equal to the logarithmic integral and the correcting terms are given by the Riemann harmonics of the nontrivial zeroes of the Riemann zeta function.

To understand this, it is highly helpful to use an analogy from physics or music: think of the prime numbers as a sound wave, and the zeros of the zeta function as the individual frequencies (harmonics) that make up that sound.

When Riemann formulated his exact equation, he basically invented a Fourier transform for the prime numbers. Here is an intuitive breakdown of how those non-trivial zeros act as the correction terms.

  1. Shifting the Goal Slightly (For Simplicity)
    Working directly with π(x) (which counts 1 for every prime) makes the exact math extremely clunky. To make the formula cleaner, mathematicians usually look at a related "weighted" prime-counting function called Chebyshev function, denoted as ψ(x).

Instead of jumping up by 1 at every prime, ψ(x) jumps by ln(p) at every prime (and prime power). It still forms a staircase shape, but it has a simpler explicit formula. The primary, smooth approximation for ψ(x) is simply the line y=x. So, instead of comparing π(x) to Li(x), we are comparing ψ(x) to x.

  1. The Explicit Formula
    The exact formula (discovered by von Mangoldt, based on Riemann's work) for the weighted prime staircase is:
ψ(x)=xρxρρln(2π)12ln(1x2)

Here:

This formula appears, roughly speaking, from the fact that $$\psi(x) = \frac{1}{2\pi i} \int_{c-i\infty}^{c+i\infty} \left( -\frac{\zeta'(s)}{\zeta(s)} \right) \frac{x^s}{s} ds$$
(see Perron's formula) together with the residue theorem.

Let's ignore the tiny trailing constants. The core of the equation is:

ψ(x)xρxρρ
  1. Turning Zeros into Waves
    How does a complex zero, ρ, turn into a "correction" on a graph?

Complex numbers have two parts: a real part and an imaginary part. If the Riemann Hypothesis is true, every single non-trivial zero lies on the "critical line," meaning they all have a real part of exactly 1/2, plus some imaginary height t.

So, we can write a zero as: ρ=12+it. If we plug this into the correction term xρ, we get:

xρ=x12+it=x1/2xit

Using Euler's formula, an imaginary exponent translates directly into sine and cosine waves. So, xit becomes an oscillating wave:

xit=cos(tlnx)+isin(tlnx)
  1. The Magic of Constructive Interference
    Each non-trivial zero ρ generates a wave that oscillates around the main line.

When you subtract just the first zero's wave from the smooth line x, it creates a gentle wobble. When you subtract the second wave, the wobble gets more detailed. As you add the waves from the 3rd, 4th, 10th, and 100th zeros, an incredible pattern emerges through constructive and destructive interference:

  1. In the spaces between prime numbers: The peaks and troughs of all these infinite waves perfectly cancel each other out (destructive interference), keeping the graph perfectly flat horizontally.
  2. Exactly at a prime number p: All the waves suddenly align to peak at the exact same moment (constructive interference), creating a sharp, vertical jump upwards.

What If a Zero get out of control?
So, what would happen if one of these zeros (ρ) decided to step off the critical line and have a real part of, say, 0.9 instead of 1/2? The entire system wouldn't completely fall apart, but the "music" of the primes would get significantly noisier. Thanks to the prime number theorem, we know no zero can have a real part of 1 or bigger, meaning our smooth baseline approximations will still dictate the overall trend as you zoom out to infinity; proportionally, they will still be a 99.9% match. But in terms of absolute distance, that rogue zero would wreck the delicate harmony. Because its real part dictates the amplitude, its wave would get massively blown out of proportion. Instead of tightly hugging the smooth curve, the prime staircase would experience wild, unpredictable wobbles, drifting massive distances away from our estimates before swinging back. Ultimately, the Riemann Hypothesis—the idea that every single zero sits exactly at 1/2—doesn't just ask if the primes follow the curve; it guarantees that they hug it as perfectly and tightly as mathematically possible, keeping the "error noise" locked at minimum.