In number theory, is the number of primes less than or equal to . Primes occur seemingly at random, so the graph of is quite irregular. This Demonstration shows how to use the zeros (roots) of the Riemann zeta function to get a smooth function that closely tracks the jumps and irregularities of . This illustrates the deep connection between the zeros of the zeta function and the distribution of primes.

Details

Snapshot 1: the graphs of and with no correction term

Snapshot 2: the graphs of and with correction term that uses the first 20 pairs of zeros of the zeta function

Snapshot 3: a closeup showing that 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, by itself misses these details

The function (Mathematica's built-in function PrimePi[x]) is a step function that jumps by 1 whenever is prime. Riemann's prime-counting function (Mathematica's built-in function RiemannR[x]) is defined as

,

where is the Möbius mu function μ (MoebiusMu[n] in Mathematica) and

is the logarithmic integral (Mathematica's built-in function LogIntegral[x]).

Overall, is a good approximation to . However, does not track the details, that is, the jumps) of . Furthermore, when a gap occurs in the primes (as, for example, between 23 and 29), keeps increasing even though remains constant between primes.

However, if we add to 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 ! When is prime, this new function increases by about 1 near , 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 .

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 , , and . The zeros occur in conjugate pairs, so if is a zero, then so is . The famous Riemann hypothesis is the claim that these complex zeros all have real part 1/2. All of the first complex zeros do, indeed, have real part 1/2 (see [4]).

This Demonstration uses an exact formula for a function that is equal to except when is prime. We define our new prime counting function, usually denoted by , as follows. First, if is a prime number, say, , then jumps from to . For this , we will define to be halfway between these two values: that is, . Second, for all other values of , . With this definition in mind, has the following exact formula:

(1) ,

where is Riemann's prime counting function defined above, and

(2) ,

where is the complex zero of the zeta function. In this formula, (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 , and with the value of that you choose with the slider control, here is how this Demonstration computes the correction term that involves zeta zeros:

First, let be the smallest integer such that . We need to add only the first terms (that is, ) in the sum in equation (1). For each of these values of , we use equation (2) to compute the value of . However, we will add only the first terms (that is, ) in the sum in equation (2). Because the purpose of this Demonstration is to show how the jumps in the step function can be closely approximated by adding to a correction term that involves zeta zeros, we ignore the integral and the in equation (2); this speeds up the computation and will not noticeably affect the graphs, especially for more than about 5.

The more zeros we use, the closer we can approximate . For larger , the correction term must include more zeros in order to accurately approximate .

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."