1 Introduction

The von Mangoldt function is defined as

$$\begin{aligned} \Lambda (n) = \left\{ \begin{array}{ll} \log p &{} : n=p^m, p\text {is prime}, m \in {\mathbb {N}}\\ 0 &{} : \text {otherwise,} \end{array} \right. \end{aligned}$$

and we will consider the sum \(\psi (x) = \sum _{n \le x} \Lambda (n)\). The prime number theorem (PNT) is the statement \(\psi (x) \sim x\) as \(x \rightarrow \infty \). For the PNT in short intervals, it is known that

$$\begin{aligned} \psi (x+h) - \psi (h) \sim h \end{aligned}$$
(1)

provided that h grows suitably with respect to x. Heath-Brown [9] has shown that one can take \(h = x^{\frac{7}{12} - \epsilon }\) provided that \(\epsilon \rightarrow 0\) as \(x \rightarrow \infty \). Assuming the Riemann hypothesis (RH), Selberg [14] showed that (1) is true for any \(h=h(x)\) such that \(h/(x^{1/2} \log x) \rightarrow \infty \) as \(x \rightarrow \infty \). On the other hand, Maier [11] has shown that the statement is false for \(h = (\log x)^{\lambda } \) for any \(\lambda > 1\).

In this paper we prove the following explicit version of Selberg’s result.

Theorem 1

Assuming RH, for any h satisfying \(\sqrt{x}\log x\le h \le x^\frac{3}{4}\) and all \(x \ge e^{10}\) we have

$$\begin{aligned} |\psi (x+h) - \psi (x)-h|< \frac{1}{\pi } \sqrt{x} \log x \log \bigg ( \frac{h}{\sqrt{x}\log x} \bigg ) + 2\sqrt{x} \log x. \end{aligned}$$
(2)

Selberg’s result follows from Theorem 1 for any \(h = f(x)\sqrt{x}\log x\) with unbounded \(f(x)=o(x)\), in that we would have

$$\begin{aligned} |\psi (x+h) - \psi (x)-h| \ll \sqrt{x} \log x \log \left( f(x) \right) = o(h). \end{aligned}$$

For \(h = c \sqrt{x} \log x\), Theorem 1 implies Cramér’s [6] result on primes in the interval \((x, x + h)\) for all sufficiently large x and c. In an earlier paper [7], the author showed that \(c = 1 + \epsilon \) is suitable for any \(\epsilon > 0\) and for all sufficiently large x. Carneiro, Milinovich and Soundararajan [4] have since shown that we can take \(c=22/55\) for all \(x\ge 4\). The same methods used in [7] are applied to reach Theorem 1. As such, it could be possible to sharpen Theorem 1 using the techniques in [4].

The closest result to Theorem 1 is the following from Schoenfeld [13].

Theorem 2

Assuming RH, for \(x \ge 73.2\) we have

$$\begin{aligned} |\psi (x) - x|< \frac{1}{8 \pi } \sqrt{x} \log ^2 x. \end{aligned}$$
(3)

Schoenfeld’s result confirms Selberg’s theorem for the slightly stronger condition of \(h/(\sqrt{x} \log ^2 x) \rightarrow \infty \). One also has from the above

$$\begin{aligned} |\psi (x+h) - \psi (x)-h | < \frac{1}{4 \pi } \sqrt{x+h} \log ^2 (x+h). \end{aligned}$$

When x is sufficiently large, Theorem 1 improves the leading constant in this bound for any choice of \(h\le x^{0.735}\).

2 Proof of Theorem 1

2.1 A smooth explicit formula

The Riemann–von Mangoldt explicit formula relates \(\psi (x)\) to the zeros of the Riemann zeta-function \(\zeta (s)\) (e.g. see Ingham [10]). Tor all non-integer \(x>0\),

$$\begin{aligned} \psi (x) = x - \sum _{\rho } \frac{x^\rho }{\rho }-\log 2\pi - \frac{1}{2} \log (1-x^{-2}), \end{aligned}$$
(4)

where the sum is over all non-trivial zeroes \(\rho = \beta +i\gamma \) of \(\zeta (s)\). We define the weighted sum

$$\begin{aligned} \psi _1 (x) = \sum _{n \le x} (x-n) \Lambda (n) = \int _2^x \psi (t) dt \end{aligned}$$
(5)

and use the following explicit formula, proved in [7] (see also Thm. 28 of [10]).

Lemma 3

For non-integer \(x>0\) we have

$$\begin{aligned} \psi _1(x) = \frac{x^2}{2} - \sum _{\rho } \frac{x^{\rho +1}}{\rho (\rho +1)} - x \log (2\pi ) + \epsilon (x) \end{aligned}$$
(6)

where

$$\begin{aligned} 1.545< \epsilon (x) < 2.069. \end{aligned}$$

The bound on \(\epsilon (x)\) has been reduced from [7], as we can write

$$\begin{aligned} \epsilon (x)&= 2\log 2\pi - 2 + \sum _\rho \frac{2^{\rho +1}}{\rho (\rho +1)} - \frac{1}{2} \int _2^x \log (1-t^{-2}) dt \\&< 2\log 2\pi - 2 + 2^\frac{3}{2}(\gamma + 2 - \log 4\pi ) + \log \frac{3\sqrt{3}}{4} < 2.069 \end{aligned}$$

and

$$\begin{aligned} \epsilon (x)> 2\log 2\pi - 2 - 2^\frac{3}{2}(\gamma + 2 - \log 4\pi ) > 1.545. \end{aligned}$$

Using a linear combination of Eq. (5), we can examine the distribution of prime powers in the interval \((x, x+h)\). For \(2\le \Delta < \sqrt{x}\log x \le h \le x\), let

$$\begin{aligned} w(n) = \left\{ \begin{array}{ll} (n-x+\Delta )/\Delta &{} : x-\Delta \le n \le x\\ 1 &{} : x \le n \le x+h\\ (x+h+\Delta -n)/\Delta &{} : x+h \le n \le x+h+\Delta \\ 0 &{} : \text {otherwise.} \end{array} \right. \end{aligned}$$

This leads to the identity

$$\begin{aligned} \sum _{n} \Lambda (n) w(n)= & {} \frac{1}{\Delta } (\psi _1(x+h+\Delta ) - \psi _1(x+h) - \psi _1 (x) + \psi _1(x-\Delta )), \end{aligned}$$

which can be verified by expanding both sides. Notice that over \(x \le n \le x+h\), the sum on the LHS is equal to \(\psi (x+h)-\psi (x)\). We thus aim to estimate this expression by bounding the RHS of (7). Using Lemma 3 in the above equation gives the following.

Lemma 4

Let \(2 \le \Delta < h \le x\) with \(x \notin {\mathbb {Z}}\). Then

$$\begin{aligned} \sum _{n} \Lambda (n) w(n) = h + \Delta - \frac{1}{\Delta } \sum _{\rho } S(\rho ) + \epsilon (\Delta ) \end{aligned}$$

where

$$\begin{aligned} S(\rho ) =\frac{ (x+h+\Delta )^{\rho +1} - (x+h)^{\rho +1} - x^{\rho +1} +(x-\Delta )^{\rho +1}}{\rho (\rho +1)} \end{aligned}$$

and

$$\begin{aligned} |\epsilon (\Delta )| < \frac{21}{20\Delta }. \end{aligned}$$

It remains to estimate the sum over zeros. We will split it into three sums,

$$\begin{aligned} \sum _{\rho } S(\rho ) = \bigg ( \sum _{| \gamma | \le \alpha x/h} +\sum _{\alpha x/h<| \gamma | < \beta x/\Delta } + \sum _{ | \gamma | \ge \beta x/\Delta } \bigg ) S(\rho ) \end{aligned}$$
(7)

where \(\alpha > 0\) and \(\beta >0\) are parameters we can later optimise over.

Lemma 5

Let \(2 \le \Delta < h \le x\) and assume RH. We have

$$\begin{aligned} \left| \sum _{| \gamma | \ge \beta x/\Delta } S(\rho ) \, \right| < \frac{4 \Delta (x+h + \Delta )^{3/2} }{\pi \beta x}\log (\beta x/\Delta ) \end{aligned}$$

provided that \(\beta x / \Delta \ge \gamma _1 = 14.13\ldots \), the ordinate of the first zero of \(\zeta (s)\).

Proof

On RH, one has

$$\begin{aligned} |S(\rho )| \le \frac{4 (x+h+\Delta )^{3/2}}{\gamma ^2}. \end{aligned}$$

The result follows from Lemma 1(ii) of Skewes [15], that for all \(T \ge \gamma _1\),

$$\begin{aligned} \sum _{\gamma \ge T} \frac{1}{\gamma ^2} < \frac{1}{2\pi } \frac{\log T}{T}. \end{aligned}$$

\(\square \)

The following lemmas require estimates on the zero-counting function N(T), which counts the number of zeros of \(\zeta (s)\) in the critical strip \(0<\beta <1\) with \(0<\gamma \le T\). Backlund [1] showed that \(N(T) = P(T) + Q(T)\), where

$$\begin{aligned} P(T) := \frac{T}{2\pi }\log {\frac{T}{2\pi }} - \frac{T}{2\pi } + \frac{7}{8} \end{aligned}$$

and \(Q(T) = O(\log T)\). Hasanalizade, Shen, and Wong [8, Cor. 1.2] have given the most recent explicit version of this, of

$$\begin{aligned} |Q(T)| \le R(T) = a_1\log {T} + a_2\log \log {T} + a_3 \end{aligned}$$
(8)

with \(a_1= 0.1038\), \(a_2=0.2573\), and \(a_3 = 9.3675\), for all \(T \ge e\).

Lemma 6

Let \(2 \le \Delta < h \le x\) and assume RH. We have

$$\begin{aligned} \left| \sum _{| \gamma | \le \alpha x/h} S(\rho ) \, \right| < \frac{\alpha x (h+\Delta ) \Delta }{ \pi h \sqrt{x-\Delta }} \log (\alpha x/h). \end{aligned}$$

Proof

We can write

$$\begin{aligned} S(\rho ) = \int _{x+h}^{x+h+\Delta } \int _{u-h-\Delta }^u t^{\rho -1} dt du, \end{aligned}$$

so, under RH, one has

$$\begin{aligned} |S(\rho )| < \frac{ (h+\Delta ) \Delta }{ \sqrt{x-\Delta }}. \end{aligned}$$

With (8), we can use

$$\begin{aligned} N(T) < \frac{T \log T}{2 \pi }, \end{aligned}$$

from which the result immediately follows. \(\square \)

For the middle sum of (7), we will use the following lemma. It follows directly from Lemma 3 of [2], in whose notation we use \(\phi (\gamma ) = \gamma ^{-1}\), and takes constants \(A_0\) and \(A_1\) from Trudgian [16, Thm. 2.2] and \(A_2\) from [2, Lem. 2].

Lemma 7

For \(2\pi \le T_1 \le T_2\) we have

$$\begin{aligned} \sum _{T_1< \gamma < T_2} \frac{1}{\gamma }&= \frac{1}{4 \pi }\log \frac{T_2}{T_1} \log \frac{T_2 T_1}{4\pi ^2} + \frac{Q(T_2)}{T_2} - \frac{Q(T_1)}{T_1} + E(T_1), \end{aligned}$$
(9)

where \(|Q(T)|\le R(T)\), defined in (8), and

$$\begin{aligned} |E(T)| \le \frac{2A_1\log T + 2A_0 + A_1 + A_2}{T^2} \end{aligned}$$

with \(A_0 = 2.067\), \(A_1 = 0.059\), \(A_2 = 1/150\).

Lemma 8

Let \(2 \le \Delta < h \le x\) and assume RH. For \(\alpha x/h\ge 15\) we have

$$\begin{aligned} \left| \sum _{\alpha x/h<| \gamma |< \beta x/\Delta } S(\rho ) \, \right| < \Delta (x+h+\Delta )^{1/2} \bigg ( \frac{1}{\pi }\log \bigg ( \frac{\beta h}{\alpha \Delta } \bigg ) \log \bigg ( \frac{\alpha \beta x^2}{4\pi ^2 h \Delta } \bigg ) + 5.4\bigg ). \end{aligned}$$

Proof

We can write

$$\begin{aligned} S(\rho ) = \frac{1}{\rho } \bigg ( \int _{x+h}^{x+h+\Delta } t^{\rho } dt - \int _{x-\Delta }^x t^{\rho } dt \bigg ), \end{aligned}$$

and so bounding trivially gives

$$\begin{aligned} | S(\rho )| \le \frac{2 (x+h+\Delta )^{1/2} \Delta }{| \gamma |}. \end{aligned}$$

It follows that

$$\begin{aligned} \left| \sum _{\alpha x/h<| \gamma |< \beta x/\Delta } S(\rho ) \, \right| \le 4 (x+h+\Delta )^{1/2} \Delta \sum _{\alpha x/h< \gamma < \beta x /\Delta } \frac{1}{\gamma }, \end{aligned}$$

on which we apply Lemma 7, and bound the smaller order terms with the assumption of \(T_1\ge 15\) to obtain the result. Note that the bound on \(T_1\) is to reduce the constant 5.4, but not restrict \(\alpha \) too much. \(\square \)

2.2 Bounding the PNT in intervals

From Lemma 4 we can write

$$\begin{aligned}&\bigg | \psi (x+h) - \psi (x) - h \bigg |< \ \frac{1}{\Delta } \Bigg | \sum _{\rho } S(\rho ) \Bigg | + \Delta + \frac{21}{20 \Delta } + \sum _{x-\Delta< n \le x} w(n) \Lambda (n) \\&+ \sum _{x+h < n \le x+h+\Delta } w(n) \Lambda (n) \end{aligned}$$

As the smooth weight has \(|w(n)| \le 1\), the above bound is no greater than

$$\begin{aligned} \frac{1}{\Delta } \Bigg | \sum _{\rho } S(\rho ) \Bigg | + \Delta + \frac{21}{20 \Delta } + 2\sum _{\begin{array}{c} x+h < p^k \le x+h+\Delta \\ k\ge 1 \end{array}} \log p. \end{aligned}$$
(10)

The largest term in this bound comes from the sum over \(\rho \), in particular, the section estimated in Lemma 8. Larger \(\Delta \) results in a smaller main-term constant, so we will set \(\Delta = C\sqrt{x}\log x\) and later choose an optimal value of \(C\in (0,1)\). The reason for not taking larger \(\Delta \) is two-fold: to keep \(\Delta < h\) and ensure the smaller terms in (10) are \(O(\sqrt{x}\log x)\).

To bound the sum over prime powers we can use Montgomery and Vaughan’s version of the Brun–Titchmarsh theorem for primes in intervals [12, Eq. 1.12]. Defining \(\theta (x) = \sum _{p\le x}\log p\), Eq. (1.12) of [12] implies

$$\begin{aligned} \theta (x+h) - \theta (x) = \sum _{x<p\le x+h} \log p \le \frac{2h\log (x+h)}{\log h}. \end{aligned}$$

The contribution from higher prime powers is relatively small, and can be bounded with explicit estimates on the difference between the Chebyshev functions \(\psi (x)\) and \(\theta (x)\). Costa Pereira [5, Thm. 2,4,5] gives lower bounds for different ranges of x. These can be combined into

$$\begin{aligned} \psi (x)-\theta (x) > 0.999x^\frac{1}{2} + \frac{2}{3} x^\frac{1}{3} \end{aligned}$$
(11)

for all \(x\ge 2187\). Broadbent et al. [3, Cor. 5.1] give

$$\begin{aligned} \psi (x) - \theta (x) < \alpha _1 x^\frac{1}{2} + \alpha _2 x^\frac{1}{3} \end{aligned}$$
(12)

with \(\alpha _1= 1+ 1.93378 \cdot 10^{-8}\) and \(\alpha _2 = 2.69\) for all \(x\ge e^{10}\). Thus, we have

$$\begin{aligned} \psi (x+h+\Delta ) - \psi (x+h)&\le \theta (x+h+\Delta ) - \theta (x+h) + E_1(x) \\&\le \frac{2\Delta \log (x+h+\Delta )}{\log \Delta } + E_1(x) \end{aligned}$$

where \(E_1(x) = \alpha _1 (x+h+\Delta )^\frac{1}{2} + \alpha _2 (x+h+\Delta )^\frac{1}{3} - 0.999(x+h)^\frac{1}{2} - \frac{2}{3} (x+h)^\frac{1}{3}\), and is bounded by \(E_1(x) \le \beta _1 x^{\frac{1}{2}} + \beta _2 x^{\frac{1}{3}}\) with

$$\begin{aligned} \beta _1 = \sqrt{3}\alpha _1 - 0.999 \quad \text {and} \quad \beta _2 = 3^{\frac{1}{3}}\alpha _2 - \frac{2}{3}. \end{aligned}$$

Here and hereafter, let \(x_0=e^{10}\). For \(x\ge x_0\) we can bound the smaller order terms in (10),

$$\begin{aligned} \Delta + \frac{21}{20 \Delta } + 2\sum _{\begin{array}{c} x+h< p^k \le x+h+\Delta \\ k\ge 1 \end{array}} \log p < K_1 \sqrt{x}\log x \end{aligned}$$

where, for \(h\le x^t\) with \(t<1\),

$$\begin{aligned} K_1&= C + \frac{4C \log (x_0+2x_0^t)}{\log (C \sqrt{x_0}\log x_0)} + \frac{2\beta _1}{\log x_0} + \frac{2\beta _2}{x_0^{\frac{1}{6}}\log x_0} + \frac{21}{20C x_0\log ^2 x_0}. \end{aligned}$$

This, along with Lemmas 5 and 6, allow us to bound

$$\begin{aligned} \bigg | \psi (x+h) - \psi (x) - h \bigg |< \frac{1}{\Delta } \Bigg | \sum _{\alpha x/h< |\gamma | < \beta x / \Delta } S(\rho ) \Bigg | + E(x,h,\Delta ) \end{aligned}$$
(13)

where

$$\begin{aligned} E(x,h,\Delta )&= K_1 \sqrt{x} + \frac{\alpha x (h + \Delta )}{\pi h \sqrt{x-\Delta } } \log \left( \frac{\alpha x}{h}\right) + \frac{4 (x+h+\Delta )^{3/2}}{\pi \beta x} \log \left( \frac{\beta x}{\Delta }\right) . \end{aligned}$$

For \(\sqrt{x}\log x\le h\le x^t\) we have

$$\begin{aligned}&E(x,h,\Delta ) \le \ K_1 \sqrt{x} + \frac{2\alpha x}{\pi \sqrt{x-C\sqrt{x}\log x}} \log \left( \frac{\alpha \sqrt{x}}{\log x}\right) \\&+ \frac{4 (x+x^t+C\sqrt{x}\log x)^{3/2}}{\pi \beta x} \log \left( \frac{\beta \sqrt{x}}{C\log x}\right) \le K_2 \sqrt{x}\log x, \end{aligned}$$

where, for \(x\ge x_0\ge e^{\beta /C}\) and \(0<\alpha \le 5\), we can take

$$\begin{aligned} K_2 = \&\frac{K_1}{\log x_0} + \frac{\alpha }{\pi } + \frac{2 (x_0+x_0^t + C\sqrt{x_0}\log x_0)^{3/2}}{\pi \beta x_0^{3/2}}. \end{aligned}$$

The first term in (13) can be estimated with Lemma 8, so that

$$\begin{aligned} \frac{1}{\Delta } \Bigg | \sum _{\alpha x/h<| \gamma |< \beta x/\Delta } S(\rho ) \Bigg |&< (x+h+\Delta )^{1/2} \bigg ( \frac{1}{\pi }\log \bigg ( \frac{\beta h}{\alpha \Delta } \bigg ) \log \bigg ( \frac{\alpha \beta x^2}{4\pi ^2 h \Delta } \bigg ) + 5.4\bigg ) \\&< \frac{\sqrt{x}}{\pi }\log x\log \left( \frac{h}{\sqrt{x}\log x}\right) + K_3 \sqrt{x} \log x, \end{aligned}$$

in which, assuming \(100 e^{-10} \le \frac{\alpha \beta }{4\pi ^2 C}\le 100\), we can take

$$\begin{aligned} K_3&= \frac{1}{\pi } \log \left( \frac{\beta }{\alpha C} \right) \log \left( \frac{\alpha \beta x_0}{4\pi ^2 C\log ^2 x_0} \right) \frac{1}{\log x_0} \\&\quad + \frac{x_0^{t/2-1/2}}{\pi \log x_0}\log \bigg ( \frac{\beta x_0^{t-1/2}}{\alpha C\log x_0} \bigg ) \log \bigg ( \frac{\alpha \beta x_0}{4\pi ^2 C\log ^2 x_0} \bigg ) \\&\quad + \frac{\sqrt{C}}{\pi x_0^{1/4} \sqrt{\log x_0}} \log \bigg ( \frac{\beta x_0^{t-1/2}}{\alpha C\log x_0} \bigg ) \log \bigg ( \frac{\alpha \beta x_0}{4\pi ^2 C\log ^2 x_0} \bigg ) \\&\quad + \frac{5.4}{\log x_0} \left( 1 + x_0^{t-1} + \frac{C\log x_0}{\sqrt{x_0}} \right) ^{1/2}. \end{aligned}$$

Note that the assumption for \(\alpha \) and \(\beta \) is to ensure certain terms are bounded for all \(x\ge x_0\). Combining estimates, we have

$$\begin{aligned} \bigg | \psi (x+h) - \psi (x) - h \bigg | <&\frac{\sqrt{x}}{\pi }\log x\log \left( \frac{h}{\sqrt{x}\log x}\right) + K_4 \sqrt{x}\log x, \end{aligned}$$
(14)

where \(K_4 = K_3 + K_2\). It remains to optimise over the parameters. Before deciding these values, recall that we have made the assumptions \(\beta \le 10C\),

$$\begin{aligned} \frac{15 h}{x} \le \alpha \le 5,\quad \beta \ge \gamma _1 \frac{C\log x}{\sqrt{x}},\quad C \alpha < \beta \le \alpha , \quad \text {and}\quad \frac{100}{e^{10}}\le \frac{\alpha \beta }{4\pi ^2 C}\le 100. \end{aligned}$$

The restriction on \(\alpha \) will be satisfied for all \(\sqrt{x}\log x\le h\le x^\frac{3}{4}\) if we take \(\alpha \ge 15 x_0^{-\frac{1}{4}}\). Optimising over C, \(\alpha \), and \(\beta \) to minimise \(K_4\), we find that choosing \(C= 0.25\) and \(\alpha = \beta = 1.35\) allows us to take \(K_4 = 2\) for all \(x\ge x_0\).