How the Zeros of the Zeta Function Predict the Distribution of Primes

​
start x axis at (from 0 to 400)
0
length of x axis (from 10 to 100)
30
pairs of zeta zeros (from 0 to 100)
0
always show Riemann's R(x)
display π(x) values in a tooltip
In number theory,
π(x)
is the number of primes less than or equal to
x
. Primes occur seemingly at random, so the graph of
π(x)
is quite irregular. This Demonstration shows how to use the zeros (roots) of the Riemann zeta function
ζ(s)
to get a smooth function that closely tracks the jumps and irregularities of
π(x)
. This illustrates the deep connection between the zeros of the zeta function and the distribution of primes.

Details

Snapshot 1: the graphs of
π(x)
and
R(x)
with no correction term
Snapshot 2: the graphs of
π(x)
and
R(x)
with correction term that uses the first 20 pairs of zeros of the zeta function
Snapshot 3: a closeup showing that
R(x)
with correction term correctly predicts the primes 103, 107, 109, 113, and 127, and the gap between 113 and 127; notice that, with no correction term,
R(x)
by itself misses these details
​
The function
π(x)
(Mathematica's built-in function PrimePi[x]) is a step function that jumps by 1 whenever
x
is prime. Riemann's prime-counting function
R(x)
(Mathematica's built-in function RiemannR[x]) is defined as
R(x)=
∞
∑
n=1
μ(n)
n
li(
1/n
x
)
,
where
μ(n)
is the Möbius mu function μ (MoebiusMu[n] in Mathematica) and
li(x)=
x
∫
0
1
log(t)
dt
is the logarithmic integral (Mathematica's built-in function LogIntegral[x]).
Overall,
R(x)
is a good approximation to
π(x)
. However,
R(x)
does not track the details, that is, the jumps) of
π(x)
. Furthermore, when a gap occurs in the primes (as, for example, between 23 and 29),
R(x)
keeps increasing even though
π(x)
remains constant between primes.
However, if we add to
R(x)
a correction term that uses the first few zeros (roots) of the Riemann zeta function, something very surprising happens: we get a new function that very closely matches the jumps and irregularities of
π(x)
! When
x
is prime, this new function increases by about 1 near
x
, so, in effect, it "knows" where the primes are. And when a gap occurs, this new function tends to level out, again emulating the behavior of
π(x)
.
It's almost as if the zeros of the zeta function determine which numbers are prime!
The first three complex zeros of the zeta function are approximately
1/2+14.135i
,
1/2+21.022i
, and
1/2+25.011i
. The zeros occur in conjugate pairs, so if
a+bi
is a zero, then so is
a-bi
. The famous Riemann hypothesis is the claim that these complex zeros all have real part 1/2. All of the first
13
10
complex zeros do, indeed, have real part 1/2 (see[4]).
This Demonstration uses an exact formula for a function that is equal to
π(x)
except when
x
is prime. We define our new prime counting function, usually denoted by
π
0
(x)
, as follows. First, if
x
is a prime number, say,
p
, then
π(x)
jumps from
π(p)-1
to
π(p)
. For this
x
, we will define
π
0
(x)
to be halfway between these two values: that is,
π
0
(p)=π(p)-1/2
. Second, for all other values of
x
,
π
0
(x)=π(x)
. With this definition in mind,
π
0
(x)
has the following exact formula:
(1)
π
0
(x)=R(x)+
∞
∑
n=1
μ(n)
n
f(
1/n
x
)
,
where
R(x)
is Riemann's prime counting function defined above, and
(2)
f(x)=-2Re
∞
∑
k=1
Ei(
ρ
k
log(x))+
∞
∫
x
1
(
3
t
-t)log(t)
dt-log(2)
,
where
ρ
k
is the
th
k
complex zero of the zeta function. In this formula,
Ei(z)
(Mathematica's built-in function ExpIntegralEi[z]) is the generalization of the logarithmic integral to complex numbers. These equations come from references[1],[2], and[3].
For a given
x
, and with the value of
N
that you choose with the slider control, here is how this Demonstration computes the correction term that involves zeta zeros:
First, let
M
be the smallest integer such that
1/M
x
<2
. We need to add only the first
M-1
terms (that is,
n=1,2,…,M
) in the sum in equation (1). For each of these values of
n
, we use equation (2) to compute the value of
f(
1/n
x
)
. However, we will add only the first
N
terms (that is,
k=1,2,…,N
) in the sum in equation (2). Because the purpose of this Demonstration is to show how the jumps in the step function
π(x)
can be closely approximated by adding to
R(x)
a correction term that involves zeta zeros, we ignore the integral and the
log(2)
in equation (2); this speeds up the computation and will not noticeably affect the graphs, especially for
x
more than about 5.
The more zeros we use, the closer we can approximate
π(x)
. For larger
x
, the correction term must include more zeros in order to accurately approximate
π(x)
.
​
References:
[1] H. Riesel, Prime Numbers and Computer Methods for Factorization, 2nd ed., Boston: Birkhauser, 1994 pp. 44–55.
[2] H. Riesel and G Gohl, "Calculations Related to Riemann's Prime Number Formula," Mathematics of Computation, 24(112), 1970 pp. 969–983.
[3] S. Wagon, Mathematica in Action, 2nd ed., New York: Springer, 1999 pp. 540–554.
[4] X. Gourdon, "The 10^13 First Zeros of the Riemann Zeta Function, and Zeros Computation at Very Large Height."

External Links

Prime Counting Function (Wolfram MathWorld)
Riemann Prime Counting Function (Wolfram MathWorld)
Riemann Zeta Function Zeros (Wolfram MathWorld)
Approximations to the Distribution of Primes
Using Zeta Zeros To Compute The Chebyshev Psi Function
Using Zeta Zeros To Compute The Mertens Function
Using Zeta Zeros To Compute A Summatory Liouville Function
Using Zeta Zeros To Count The Squarefree Integers
Using Zeta Zeros To Tally The Euler Phi Function

Permanent Citation

Robert Baillie
​
​"How the Zeros of the Zeta Function Predict the Distribution of Primes"​
​http://demonstrations.wolfram.com/HowTheZerosOfTheZetaFunctionPredictTheDistributionOfPrimes/​
​Wolfram Demonstrations Project​
​Published: March 7, 2011