Tables of values of pi(x) and of pi2(x)



Introduction

Some of my computational projects require the evaluation of a function for each prime number inside a given interval. To guard against random computational errors (usually originated in the memory subsystem), the computations inside each interval should be done at least twice and should be discarded if the results disagree. A much less reliable and less expensive alternative is to verify if the number of primes inside the interval being analyzed agrees with an independent count obtained by other means. This number of primes can be computed easily if a table of values of the prime counting function pi(x), which counts the number of primes not larger than x, contains entries for the two endpoints of the interval.

When p and p+2 are both prime, they are said to form a twin prime pair. In contrast to pi(x), the only know way to count the number of twin prime pairs with p<=x, denoted by pi2(x), is to generate them all.

Because freely available extensive tables of values of pi(x) and of pi2(x) are quite rare (besides my own tables, Thomas R. Nicely's tables are the only extensive ones I know of), in order to be able to check my computations I made the tables described below. For pi(x), these tables were made in part with my inefficient implementation of the Lagarias-Miller-Odlyzko variant of the Meissel-Lehmer method, described in [1], and in part with my efficient implementation of the Deléglise-Rivat variant of the same method, described in [2] and in [3]. For pi2(x), the tables are a by-product of my Goldbach conjecture verification project.

Tables of values of pi(x)

(6330224 entries in the database; some entries computed by Thomas Nicely.)

Warning: Some of the values of pi(x) were double-checked by running the same program twice, usually in the same machine, using the same internal parameters. Thus, they have been double-checked against random machine errors, but not against algorithmic or consistent machine errors (such as the infamous Pentium fdiv hardware bug). Nonetheless, I am 99.99% confident that all results presented in these tables are correct. All cross-checks (different machines and/or different internal parameters) performed so far produced exactly the same results.

Comparison between pi(x) and li(x)

The prime number theorem states that pi(x) does not deviate much from the so-called logarithmic integral li(x), defined by

                     x     dt
li(x) = P.V. INTEGRAL    ------ .
                     0   log(t)

It is known that li(x)-pi(x) changes sign infinitely often. However, it is also known that negative values of li(x)-pi(x) are extremelly rare [4]. Let

         li(x) - pi(x)
H(x) = 2 ------------- .
          li(sqrt(x))

We took the liberty of replacing pi(sqrt(x)) by its approximation li(sqrt(x)) in the definition of H(x); this was done only to simplify its computation. It was shown in [5] than H(x) can be approximated quite well by

                         sin(t log(x))
H(x,L) = 1 + 2    SUM    ------------- ,
               0 < t < L       t

where the sum is over the imaginary part of the roots on the upper half, up to height L, of the critical line of the zeta function. There exists a more precise formula, in which the zeros are only required to be on the critical strip. The first 10^13 zeros are known to lie on the critical line, as shown in 2004 by Xavier Gourdon. The following figure presents the function H(x) computed using the data in our pi(x) tables (blue curve), as well as its approximation using only the first ten and the first one hundred zeros of the zeta function on the upper part of the critical line (yellow curve and white curve, respectively). It can be seen in the figure that the approximation captures quite well the "low-frequency" behaviour of H(x). When much more zeros are used (not shown), the two curves become almost indistinguishable.

Graphs of H(x) and of H(x,50)

Tables of values of pi2(x)

(6152527 entries in the database; some entries computed by Thomas Nicely.)

Warning: The values of pi2(x) for x>357425·10^12 reported in these tables before March 1, 2008, were too small (by one).

Tables of values of pi(x) mod 2

Using the ideas of [6], it is possible to compute pi(x) mod 2 quickly using a very simple program. Using the ideas of section 2.1 of that paper, possibly coupled with a way to compute quickly several values of the summation of the Möbius function [7], would make the program even quicker. The results presented below were produced by our initial simple implementation, which has a computational complexity of O(x^(0.5+ε)).

Estimates of pi(x) for "large" values of x

Using Riemann's exact formula for pi(x) and the first 10^9 zeros of the zeta function on the critical line, accurate to 20 digits after the decimal point, we made a computer program able to estimate the value of pi(x) for x up to about 10^30. Assuming that the values of t log(x) are uniformly distributed modulo 2pi, where t is, as before, the imaginary part of the zero, it is possible to model the terms not used in the formula as a Gaussian random variable with zero mean and an approximate standard deviation which is easy to compute. Unfortunately, this standard deviation decreases slowly with the number of zeros used, to the point that one hundred times the number of zeros gives us less than one extra digit of precision. The estimates in the following table should be compared to the exact values in the tables given above (of course, for the values of x for which exact values are known).

References

[1] J. C. Lagarias, V. S. Miller, and Andrew Odlyzko, Computing pi(x): the Meissel-Lehmer method, Mathematics of Computation, vol. 44, no. 170, pp. 537-560, April 1985.
[2] M. Deléglise and J. Rivat, Computing pi(x): the Meissel, Lehmer, Lagarias, Miller, Odlyzko method, Mathematics of Computation, vol. 65, no. 213, pp. 235-245, January 1996.
[3] Tomás Oliveira e Silva, Computing pi(x): the combinatorial method, Revista do DETUA, vol. 4, no. 6, pp. 759-768, March 2006.
[4] Carter Bays and Richard H. Hudson, A new bound for the smallest x with pi(x)>li(x), Mathematics of Computation, vol. 69, no. 231, pp. 1285-1296, 2000.
[5] Carter Bays and Richard H. Hudson, Zeroes of Dirichlet L-functions and irregularities in the distribution of primes, Mathematics of Computation, vol. 69, no. 230, pp. 861-866, 2000.
[6] Terence Tao, Ernest Croot III, and Harald Helfgott, Deterministic methods to find primes, Mathematics of Computation, published electronically on August 23, 2011.
[7] Mark Deléglise and Joël Rivat, Computing the Summation of the Möbius function, Experimental Mathematics, Vol. 5, No. 4, pp. 291-295, 1996.

Additional links