1 Introduction

One version of the prime number theorem is that \(\theta (x) \sim x\), where \(\theta (x) = \sum _{p\le x} \log p\). Several applications call for an explicit estimate on the error \(\theta (x) - x\). Schoenfeld [21, Thm 11] proved that for

$$\begin{aligned} \epsilon _{0}(x) = \sqrt{\frac{8}{17 \pi }} X^{1/2}e^{-X}, \quad X = \sqrt{(\log x)/R_{0}}, \quad R_{0}= 9.6459, \end{aligned}$$
(1)

the following inequality holds:

$$\begin{aligned} |\theta (x) - x| \le x \epsilon _{0}(x) \quad (x \ge 101). \end{aligned}$$

The pair of numbers \((R_{0}, 17)\) in (1) is particularly interesting. These arise from [20, Thm 1], namely the theorem that

$$\begin{aligned} \zeta (s)\text { has no zeroes in the region} \; \sigma \ge 1- \frac{1}{R \log |\frac{t}{B}|} \quad (t\ge t_{0}) \end{aligned}$$
(2)

for \(R= R_{0}\), \(B= 17\) and \(t_{0} = 21\). Ramaré and Rumely [17, p. 409] proved (2) with \((R, B, t_{0}) = (R_{0}, 38.31, 1000)\); Kadiri [12] proved (2) with \((R, B, t_{0}) = (5.69693, 1, 2)\).

A meticulous overhaul of Schoenfeld’s paper would be required to furnish a ‘general’ version of (2), that is, one in which \(B\) and \(R\) are chosen for maximal effect. This article does not attempt such an overhaul. Rather, forcing \(B\) to be \(17\) in (2) means that many of the numerical estimations in Schoenfeld’s article can be let through to the keeper. With \(B= 17\), one can obtain admissible values of \(R\) and \(t_{0}\) in (2) as follows.

Let the Riemann hypothesis be true up to height \(H\): by Platt [15] we have \(H= 3.061\times 10^{10}\). Let \(\rho \) represent a non-trivial zero of \(\zeta (s)\) with \(\rho = \beta + i\gamma \). Using Kadiri’s result, we see that

$$\begin{aligned} \beta \le 1 - \frac{1}{5.69693 \log t} \le 1 - \frac{1}{R \log |\frac{t}{17}|} \end{aligned}$$

provided that

$$\begin{aligned} t\ge \exp \left\{ \frac{R \log 17}{R - 5.69693}\right\} . \end{aligned}$$

Set \(H = \exp \{R \log 17/(R - 5.69693)\}\), whence we may take \(R = 6.455\). We conclude that there are no zeroes in

$$\begin{aligned} \sigma \ge 1 - \frac{1}{6.455 \log |\frac{t}{17}|}, \quad (t\ge 24). \end{aligned}$$
(3)

This enables us to prove good bounds for \(\theta (x) -x\) and for \(\psi (x) -x\), where \(\psi (x) = \sum _{p^{m}\le x} \log p\), as indicated in the following theorem.

Theorem 1

Let

$$\begin{aligned} \epsilon _{0}(x) = \sqrt{\frac{8}{17 \pi }} X^{1/2}e^{-X}, \quad X = \sqrt{(\log x)/R}, \quad R = 6.455. \end{aligned}$$

Then

$$\begin{aligned}&|\theta (x) - x| \le x \epsilon _{0}(x) \quad (x \ge 149)\\&|\psi (x) - x| \le x \epsilon _{0}(x) \quad (x \ge 23). \end{aligned}$$

Throughout Schoenfeld’s paper numerous bounds on \(x\) are imposed, where \(X = \sqrt{(\log x)/R_{0}}\). Fortunately, for our purposes, all of these arise from bounds imposed on \(X\). For example, the first bound in [21, (7.30)] requires \(X \ge 17/2\pi \). With our value of \(R\), we need \(\log x \ge 48\) compared with Schoenfeld’s requirement \(\log x \ge 71\). Making these slight changes throughout pp. 342–348 of [21], we find that

$$\begin{aligned} |\psi (x) - x|, \quad |\theta (x) - x| \le x \epsilon _{0}(x) \quad (\log x \ge 1163). \end{aligned}$$
(4)

In order to prove Theorem 1, we cover small values of \(x\) following the approach on pp. 348–349 of [21] but using the superior bounds on \(|\psi (x) -x|\) as given by Faber and Kadiri [6]. We make use of Eq. (\(5.3^{*}\)) in [21], namely

$$\begin{aligned} \psi (x) - \theta (x) < 1.001093 x^{1/2} + 3x^{1/3} \le A(x_{0}) x \quad (x\ge x_{0}), \end{aligned}$$

where \(A(x_{0}) = 1.001093 x_{0}^{-1/2} + 3x_{0}^{-2/3}.\) For \(e^{25} \le x \le e^{45}\) we have, by [6, Table 3],

$$\begin{aligned} |\psi (x) - x|, \quad |\theta (x) - x| \le (A(e^{25}) +4.9\times 10^{-5}) \frac{x\epsilon _{0}(x)}{\epsilon _{0}(e^{45})} \le 0.003 x\epsilon _{0}(x). \end{aligned}$$

Now for \(e^{45} \le x \le e^{1163}\) we have

$$\begin{aligned} |\psi (x) - x|, \quad |\theta (x) - x| \le (A(e^{45}) +1.1\times 10^{-8}) \frac{x\epsilon _{0}(x)}{\epsilon _{0}(e^{1162})} \le 0.006 x\epsilon _{0}(x). \end{aligned}$$

Hence (4) is true for all \(x\ge e^{25}\). For \(x< e^{25}\), note that \(\epsilon _{0}(x)\) increases for \(X<\frac{1}{2}\) and decreases thereafter. Therefore

$$\begin{aligned} \epsilon _{0}(x) \ge \min \{\epsilon _{0}(2), \epsilon _{0}(e^{25})\} \ge 0.075. \end{aligned}$$
(5)

Theorem 10 in [19] gives \(\theta (x) > 0.93x\) for \(x\ge 599\). This, combined with (5), shows that

$$\begin{aligned} \theta (x) -x > -x\epsilon _{0}(x) \quad (x\ge 599). \end{aligned}$$
(6)

Since \(\psi (x) \ge \theta (x)\), the inequality in (6) also holds with \(\psi (x)\) in place of \(\theta (x)\). Using \(\psi (x) \le 1.04 x\) (see Theorem 12 in [19]) and (5) gives

$$\begin{aligned} \theta (x) \le \psi (x) \le 1.04 x < x+ x\epsilon _{0}(x) \quad (2\le x \le e^{25}). \end{aligned}$$

All that remains is to verify (6) and the analogous inequality for \(\psi (x)\) for values of \(x\le 599\)—a computational dolly.

2 The difference \(\pi (x) - \text {li}(x)\)

Let \(\pi (x)\) denote the number of primes not exceeding \(x\) and \(\text {li}(x)\) denote the logarithmic integral, namely

$$\begin{aligned} \text {li}(x) = \lim _{\epsilon \rightarrow 0^{+}} \left( \int _{0}^{1- \epsilon } \frac{\hbox {d}t}{\log t} + \int _{1+ \epsilon }^{x} \frac{\hbox {d}t}{\log t}\right) . \end{aligned}$$

Concerning the difference \(\pi (x) - \text {li}(x)\), we have

$$\begin{aligned} |\pi (x) - \text {li}(x)| \le 0.4394 \frac{x}{(\log x)^{3/4}} \exp (-\sqrt{(\log x)/9.696}) \quad (x\ge 59), \end{aligned}$$
(7)

due to Dusart [4, Thm 1.12].Footnote 1 Good bounds on \(\pi (x) - \text {li}(x)\) can be obtained from good bounds on \(\theta (x) -x\), since

$$\begin{aligned} \pi (x) - \text {li}(x)&= \frac{\theta (x)}{\log x} + \int _{2}^{x}\frac{\theta (t)}{t \log ^{2} t}\, \hbox {d}t - \int _{2}^{x} \frac{\hbox {d}t}{\log t} - \text {li}(2)\nonumber \\&= \frac{\theta (x)-x}{\log x} + \frac{2}{\log 2} + \int _{2}^{x}\frac{\theta (t)-t}{t \log ^{2} t}\, \hbox {d}t - \text {li}(2). \end{aligned}$$
(8)

Using Theorem 1 we can prove

Theorem 2

$$\begin{aligned} |\pi (x) - \text {li}(x)| \le 0.2795 \frac{x}{(\log x)^{3/4}} \exp \left( -\sqrt{\frac{\log x}{6.455}}\right) \quad (x\ge 229). \end{aligned}$$

Proof

We split up the range of integration in (8) so that \(\int _{2}^{x} = \int _{2}^{x_{0}} + \int _{x_{0}}^{x} = I_{1} + I_{2}\) for some \(x_{0}\ge 149.\) To estimate \(I_{2}\), we use Theorem 1 and consider

$$\begin{aligned} g(t) = \frac{t \epsilon _{0}(t)}{(\log t)^{\alpha + \frac{1}{4}}}. \end{aligned}$$

The value of \(\alpha \) in the expression for \(g(t)\) must be less than \(7/4\). Following Dusart we choose \(\alpha = 7/5\), whence it is easy to verify that \(\epsilon _{0}(t)/(\log t)^{2} < g'(t)\) for all \(t\ge 149\).

To estimate \(I_{1}\), we invoke [19, Thm 19]

$$\begin{aligned} \theta (t) < t, \quad t<10^{8}. \end{aligned}$$

Interchanging summation and integration, we have

$$\begin{aligned} \int _{2}^{x_{0}} \frac{\theta (t)}{t\log ^{2} t}\, \hbox {d}t = \int _{2}^{x_{0}} \frac{\sum _{p\le t}\log p}{t \log ^{2} t}\, \hbox {d}t = \sum _{p\le x_{0}} \log p \int _{p}^{x_{0}} \frac{\hbox {d}t}{t \log ^{2} t} = \pi (x_{0}) - \frac{\theta (x_{0})}{\log x_{0}}. \end{aligned}$$

Therefore (8) becomes

$$\begin{aligned} |\pi (x) - \text {li}(x)|&\le \frac{x \epsilon _{0}(x)}{\log x} + \frac{x\epsilon _{0}(x)}{(\log x)^{33/20}} + \frac{2}{\log 2} - \text {li}(2) -\frac{x_{0}\epsilon _{0}(x_{0})}{(\log x_{0})^{33/20}} \\&\quad + \int _{2}^{x_{0}} \frac{\hbox {d}t}{\log ^{2} t} -\pi (x_{0}) + \frac{\theta (x_{0})}{\log x_{0}}. \end{aligned}$$

We may choose \(x_{0}\) in (8) subject to \(149\le x_{0}\le 10^{8}\). Choosing \(x_{0} = 10^{8}\) shows, in \({<}3\) min using Mathematica on a 1.8-GHz laptop, that

$$\begin{aligned} |\pi (x) - \text {li}(x)| \le \frac{x \epsilon _{0}(x)}{\log x} + \frac{x\epsilon _{0}(x)}{(\log x)^{33/20}} \le 1.151 \frac{x \epsilon _{0}(x)}{\log x} \end{aligned}$$
(9)

for \(x\ge 10^{8}\). For smaller \(x\), we note that by Kotnik [13] \(\pi (x) < \text {li}(x)\) for \(2\le x \le 10^{14}\). Therefore

$$\begin{aligned} \max _{x\in [p_{k}, p_{k+1})} |\pi (x) - \text {li}(x)| = \max _{x\in [p_{k}, p_{k+1})} \text {li}(x) - \pi (x) \le \text {li}(p_{k+1}) - k. \end{aligned}$$
(10)

Using (10) we verify (9) for all \(x\ge p_{k}\) with \(k \ge 48\), which is equivalent to \(x\ge 229\), which proves the theorem. \(\square \)

3 Applications

We now present four applications of Theorems 1 and 2. We stress that explicit results of this nature have many uses throughout the literature; our list of four applications is by no means exhaustive. One striking example of this applicability is Helfgott’s proof of the ternary Goldbach conjecture [11]. In [11, §7], Helfgott makes frequent use of estimations for the number of primes in short intervals and the size of the Chebyshev functions.

3.1 Intersecting arithmetic progressions

Let \(N_{t}(k)\) denote the maximum number of distinct arithmetic progressions of \(k\) numbers such that any pair of progressions has \(t\) members in common. Ford [8] considers the following example.

Example 1

For \(1\le i < j \le k\), let \(B_{ij}\) be the arithmetic progression, the \(i\)th element of which is 0 and the \(j\)th element of which is \(k!\).

Ford shows, in Theorem 3 of [8], that, for all \(k\ge 10^{8000}\), \(N_{2}(k) = k(k-1)/2\), and that every configuration of \(k(k-1)/2\) arithmetic progressions with 2 points in common is equivalent (up to translations and dilations) to the arithmetic progression in Example 1. We are able to use Theorem 1 to prove

Corollary 1

For \(k \ge 10^{4848}\), we have \(N_{2}(k) = k(k-1)/2\) and that every configuration of \(k(k-1)/2\) arithmetic progressions with 2 points in common is equivalent to the arithmetic progression in Example 1.

Proof

Analogous to Lemmas 3.3 and 3.4 in [8], we can show that, for \(k\ge e^{280}\), there is always a prime in the interval \([k, k+a]\), where

$$\begin{aligned} a = 0.56 k(\log k)^{1/4}\exp (-\sqrt{(\log k)/6.455}). \end{aligned}$$
(11)

We now follow the proof of Theorem 3 in [8] using our (11) in place of his \(a = 0.44 k(\log k)^{1/4} \exp (-0.321979\sqrt{\log k}).\) \(\square \)

It is worthwhile to remark that Corollary 1 could be improved if the method in [9] were made explicit. However, it seems unlikely that one could reduce the bound on \(k\) in Corollary 1 to a height below which direct computation could be carried out.

3.2 Primes in short intervals

Various results have been proved about the existence of a prime in a short interval \([x, x+ f(x)]\), where \(f(x) = o(x)\). For example, Dusart [5, Prop. 6.8] has shown that there exists a prime in the interval \([x, x + \frac{x}{25\log ^{2}x}]\) whenever \(x\ge 396738\). We improve this in

Corollary 2

For all \(x\ge 2898242\), there is a prime in the interval

$$\begin{aligned} \left[ x, x\left( 1 + \frac{1}{111\log ^{2}x}\right) \right] . \end{aligned}$$

We first prove the following:

Lemma 1

For \(x\ge e^{35}\) we have

$$\begin{aligned} |\theta (x)- x| \le \frac{0.0045x}{\log ^{2} x}. \end{aligned}$$
(12)

Proof

Using (\(5.3^{*}\)) of [21] we have

$$\begin{aligned} \frac{|\theta (x) -x|\log ^{2} x}{x} \le \left( \frac{|\psi (x) -x|}{x} \log ^{2}x + \frac{1.001093 \log ^{2} x}{\sqrt{x}} + \frac{3\log ^{2}x}{x^{2/3}}\right) = B(x), \end{aligned}$$
(13)

say. According to Table 3 in [6], \(|\psi (x) - x|\le 7.4457\times 10^{-7}\) for \(x\ge e^{35}\), whence \(B(x)\) is bounded above by

$$\begin{aligned} \left( 7.4457\times 10^{-7} \log ^{2}x + \frac{1.001093 \log ^{2} x}{\sqrt{x}} + \frac{3\log ^{2}x}{x^{2/3}}\right) \bigg |_{x = e^{75}}, \quad x\in [e^{35}, e^{75}], \end{aligned}$$

which is bounded above by 0.0042. We continue in this way, using intervals of the form \([e^{a}, e^{b}]\), Faber and Kadiri’s bounds at \(e^{a}\) and evaluating \(B(x)\) at \(x=e^{b}\). The results are summarised below in Table 1.

Table 1 Bounding \(\theta (x) - x\)

Taking the maximum entry in the right-hand column of the table proves Lemma 1 for \(e^{35}\le x \le e^{4000}\). When \(x\ge e^{4000}\) we use Theorem 1. This completes the proof of the lemma. \(\square \)

Note that one could refine this result by taking more intermediate steps in the argument. For example, one could use the interval \([e^{2000}, e^{2100}]\) to try to reduce the bound of \(0.0045\). We have not pursued this since the entry \(e^{2100}\) is not in Table 3 in [6] and, while it could be calculated, the above lemma is sufficient for our purposes.

We now use Lemma 1 to exhibit primes in short intervals. Indeed, for \(x\ge e^{35}\), Lemma 1 shows that

$$\begin{aligned} \theta \left\{ x\left( 1 + \frac{1}{c\log ^{2} x}\right) \right\} - \theta (x) \end{aligned}$$

is positive provided that \(c\le 111.1107\ldots \). Taking \(c=111\), we conclude that there is always a prime in the interval \([x, x(1+ 1/(111 \log ^{2} x))]\) whenever \(x\ge e^{35}\). This establishes Corollary 2 when \(x\ge e^{35} \approx 1.58\times 10^{15}\). Rather than performing the herculean, if not impossible, feat of examining all those \(x< e^{35}\) we proceed as follows.

Suppose that \(p_{n+1} - p_{n}\le X_{1}\) for all \(p_{n} \le x_{1}\), where \(x_{1} \ge e^{35}\). That is, the maximal prime gap of all primes up to \(x_{1}\) is at most \(X_{1}\). Therefore, \(p_{n+1} \le p_{n} + X_{1}\) which will be lesser than \(p_{n}\left( 1+ \frac{1}{111 \log ^{2}p_{n}}\right) \) as long as

$$\begin{aligned} \frac{p_{n}}{\log ^{2}p_{n}} \ge 111 X_{1}. \end{aligned}$$
(14)

If (14) holds for all \(y_{1} \le p_{n} \le x_{1}\), we can conclude that Corollary 2 holds for all \(x\ge y_{1}\). If \(y_{1}\) is still too high for a direct computation over all integers less than \(y_{1}\), then we may play the same game again, namely find an \(x_{2}\ge y\) such that \(p_{n+1} - p_{n} \le X_{2}\).

Nyman and Nicely [14, Table 1] show that one may take \(x_{1} = 1.68\times 10^{15}\), which is greater than \(e^{35}\), and \(X_{1} = 924\). It is easy to verify that (14) holds for all \(p_{n} \ge 3.05\times 10^{7}\). We can now check relatively swiftly that the maximal prime gap for \(p_{n} < 3.06\times 10^{7}\) is \(210\). We may now verify Corollary 2 for all \(x\ge 5.63\times 10^{6}\). After two more applications of this method, using the fact that the maximal prime gap for \(p_{n} < 5.7\times 10^{6}\) is \(159\), and for \(p_{n} < 4\times 10^{6}\) is \(148\) we see that Corollary 2 is true for all \(x\ge 3.8\times 10^{6}\).

We now examine \(x \le 3.8\times 10^{6}\). An exhaustive search took less than two minutes on Mathematica—this completes the proof of Corollary 2.

There are several ways in which this result could be improved. Extending the work done by Nyman and Nicely [14] makes a negligible difference to the choice of \(c\). Probably, the best plan of attack is to reduce the size of the coefficient in Lemma 1. For example, if the coefficient in (12) were reduced to \(0.0039\), we could take \(c=128\).

Finally, the result in Corollary 2 ought to be compared with the sharpest known result for a different short interval. Ramaré and Saouter [18, Table 1] proved that there is always a prime in the interval

$$\begin{aligned} (x(1-\Delta ^{-1}), x],\quad \Delta = 212215384, \quad x\ge e^{150}. \end{aligned}$$

Corollary 2 improves on this whenever \(x\ge 3.2\times 10^{600} \approx e^{1383}\). Although this value of \(x\) is large by anyone’s standards, it appears that Corollary 2 could be useful in searching for primes between cubes—see [2].

3.3 A conjecture by Pomerance

Consider numbers \(k>1\) for which the first \(\phi (k)\) primes coprime to \(k\) form a reduced residue system modulo \(k\). Following the lead of Hajdu et al. [10], we call such an integer \(k\) a P-integer. For example, \(12\) is a \(P\)-integer and \(10\) is not since

$$\begin{aligned} \{5,7,11,13\} \equiv \{5, 7, 11, 1\}, \quad \quad \{3,7,11,13\} \equiv \{ 3,7,11,3\}, \end{aligned}$$

and, whereas the first is a reduced residue system, the second is not. From [16, Thm 2], Pomerance deduced that there can be only finitely many \(P\)-integers. Hajdu et al.[op. cit.] proved, inter alia, that if \(k\) is a \(P\)-integer such that \(k> 30\), then \( 10^{11}< k < 10^{3500}.\) As noted by Hajdu et al., one may improve (7) using the zero-free region proved by Kadiri, that is, using our Theorem 1. We do this thereby proving

Corollary 3

If \(k\) is a \(P\)-integer, then \(k < 10^{1805}\).

Proof

We use Theorem 2 instead of Lemma 2.1(iii) in [10] and proceed as in [10, §5]. Let \(k\ge 10^{1805}\) and define

$$\begin{aligned} f_{0}(k)&= \frac{k}{\log k/2} + \frac{k}{\log ^{2} k/2} + \frac{1.8 k}{\log ^{3} k/2} - \frac{k}{\log k} - \frac{k}{\log ^{2}k} - \frac{2.51 k}{\log ^{3} k} - \log k,\nonumber \\ f_{n}(k)&= \frac{k}{4(n+1)\log ^{2}(nk +k)} - 1.118 \frac{nk +k}{(\log nk)^{3/4}} \exp ( - \sqrt{\log (nk)/6.455}),\quad \quad \end{aligned}$$
(15)

where the constant \(1.118\) is four times that appearing in Theorem 2. Lemma 3.1 in [10] gives the following:

$$\begin{aligned} k\text { is not a }P\text {-integer if} \quad f_{0}(k) + \sum _{n=1}^{L} f_{n}(k) >0, \end{aligned}$$
(16)

where \(L\) satisfies

$$\begin{aligned} L \ge \frac{\log k - \log h(k)}{h(k)} -2, \quad h(k) = 1.7811\log \log k + 2.51/(\log \log k). \end{aligned}$$

When \(k\ge 10^{1805}\) we have \(L\ge 273\). We verify that the condition in (16) is met for \(273\le L \le 3800\). We now proceed as in [10, p. 181] with 3800 and \(k= 10^{1805}\) in place of 1500 and \(k= 10^{3500}\), respectively. \(\square \)

The numbers 1.8 and 2.51 appearing in (15) are worth a mention. These are approximations to the number 2 that appears in the expansion

$$\begin{aligned} \pi (x) \sim \frac{x}{\log x} + \frac{x}{\log ^{2} x} + \frac{2x}{\log ^{3} x} + \cdots \end{aligned}$$

Replacing these numbers in (15) by 2, a situation in which one could not possibly improve, makes a negligible difference. Indeed, such a substitution could not improve the bound in Corollary 3 to \(k< 10^{1803}\).

It is certainly possible that a refined version of Theorem 1 could resolve completely the Pomerance conjecture. Indeed, using a slightly different approach, Togbé and Yang have announced in [22] a proof of the conjecture.

3.4 An equality studied by Ramanujan

Ramanujan [1, Ch. 24] proved that

$$\begin{aligned} \pi (x)^{2} < \frac{e x}{\log x} \pi \left( \frac{x}{e}\right) \end{aligned}$$
(17)

holds for all sufficiently large values of \(x\). In a paper to appear, Dudek and Platt [3] have used Theorem 1 to show that, using the Riemann hypothesis, (17) is true for all \(x> 38,358,837,682.\) It seems difficult to prove this unconditionally: in this case Dudek and Platt are able to show that (17) is true for all \(x\ge \exp (9658)\).

4 Conclusion

Theorems 1 and 2 could be improved in several ways: First, if one knew that the Riemann hypothesis had been verified to a height greater than \(3.061\times 10^{10}\), one could reduce the coefficient in the zero-free region in (3). Second, one could try to improve Kadiri’s zero-free region either by reducing the value of \(R\) or by improving the size of \(B\) in (2). A higher verification of the Riemann hypothesis has a mild influence on this method of proof.

Third, one may feed any improvements in a numerical verification of the Riemann hypothesis and the zero-free region into Faber and Kadiri’s argument, thereby improving the estimate on \(\psi (x) - x\). Finally, one may try to overhaul completely Schoenfeld’s paper in order to provide a bespoke version of Theorem 1.