1 Introduction and results

A central problem in number theory concerns estimates on \(L(1, \chi )\), where \(\chi \) is a non-principal Dirichlet character to the modulus q, and where \(L(s, \chi )\) is its associated Dirichlet L-function. Bounding sums of \(\chi (n)\) trivially leads to the bound \(|L(1, \chi )| \leqslant \log q + O(1)\). The Pólya–Vinogradov inequality allows one to improve this to \((1/2)\log q + O(1)\). An interesting history of these developments is given by Pintz [28].

Explicit versions of the above results date back to Hua [10]. See also work by Louboutin [22] and the second author [32, 33] for finding small pairs \(c, q_{0}\) such that \(|L(1, \chi )|\leqslant (1/2) \log q + c\) for all \(q\geqslant q_{0}\). It appears difficult to improve on these bounds for generic q.

When q is prime, the best result is due to Stephens [37], namely that \(|L(1, \chi )|\leqslant \frac{1}{2}(1 - e^{-1/2} + o(1))\log q\), where \(\frac{1}{2}(1- e^{-1/2}) = 0.1967\ldots \). This result has been extended to arbitrary moduli by Pintz in [28, 29]. In this paper we focus on quadratic characters \(\chi \) for which it is known (see, e.g., §6 in [7]) that \(L(1, \chi )>0\). We aim at making the Pintz–Stephens result partially explicit in the following theorems.

Theorem 1

Let \(\chi \) be a quadratic odd primitive Dirichlet character modulo \(q\geqslant 2\cdot 10^{23}\). We have \(L(1,\chi )\leqslant (\log q)/2\).

For all even characters (not just quadratic ones) it is known that \(|L(1, \chi )| \leqslant (\log q)/2\), for all \(q\geqslant 2\). This is proved in [32] after several papers by Louboutin, the last of which is [22]. Bounds relying on additional constraints on the characters at the small primes have been investigated by Louboutin in [23], by the second author in [33], by Saad Eddin in [36] and by Platt and Saad Eddin in [30]. On taking q to be larger, we can improve on the factor 1/2 in Theorem 1.

Theorem 2

Let \(\chi \) be a quadratic primitive Dirichlet character modulo q. The inequality \(L(1,\chi )\leqslant (9/20)\log q\) holds true when \(\chi \) is even and \(q\geqslant 2\cdot 10^{49}\) or \(\chi \) is odd and \(q\geqslant 5\cdot 10^{50}\).

We note that, on the Generalized Riemann hypothesis much more is known. Littlewood [21] showed that \(L(1, \chi ) \ll \log \log q\). This has been made explicit for large q in [15] by Lamzouri, Li and Soundararajan, and then for all q in [17] by Languasco and the third author. Finally, although we do not consider lower bounds on \(L(1, \chi )\), we direct the reader to a survey of explicit and inexplicit bounds of Mossinghoff, Starichkova and the third author in [25], and to the recent work [16].

The outline of this paper is follows. In § 2 we assemble some bounds on prime counting functions and on related inequalities. In § 3 we collect the necessary explicit results on character sums. In § 4 we prepare the technical preliminaries to Stephens’ approach, and analyse these in § 5. Our § 6 is purely centred on the optimization in (an improved version of) Stephens’ method, and contains no number-theoretic input. Finally, in § 7 we prove Theorems 1 and 2.

We use the notation \(f(x)={\mathcal {O}}^*(g(x))\) to mean that \(|f(x)|\leqslant g(x)\) for the range of x considered. Note that this differs from the usual big-O notation, as it takes the implied constant to be 1. We also let

$$\begin{aligned} \Lambda (n)= {\left\{ \begin{array}{ll} \log p,&{} \text {if }n=p^k \text { for some prime }p \text { and integer }k\geqslant 1,\\ 0, &{} \text {otherwise} \end{array}\right. } \end{aligned}$$

be the usual von Mangoldt function. Throughout this paper we shall let \(H>1\) be a parameter, which ultimately we shall optimise. With that in mind, we define

$$\begin{aligned} h(\chi ,y)=\sum _{n\leqslant H^y}\frac{\chi (n)\Lambda (n)}{n},\quad h(1,y)=\sum _{n\leqslant H^y}\frac{\Lambda (n)}{n}. \end{aligned}$$
(1)

In addition, for \(x\geqslant 0\) define

$$\begin{aligned} f(x)=H^{-x}\sum _{n\leqslant H^x}\chi (n), \quad F(x)=\int _0^x f(t)dt =\sum _{n\leqslant H^x}\frac{\chi (n)}{n\log H} -\frac{f(x)}{\log H}. \end{aligned}$$
(2)

We note that the second inequality in (2) follows from the first and partial summation. Namely,

$$\begin{aligned} \sum _{n\leqslant H^x}\frac{\chi (n)}{n}&=\frac{\sum _{n\leqslant H^x}\chi (n)}{H^x}+\int _0^{H^x}\frac{1}{H^{2t}}\sum _{n\leqslant H^t}\chi (n)\,d(H^t)\\&=\frac{\sum _{n\leqslant H^x}\chi (n)}{H^x}+\int _0^{x}\frac{\log H}{H^{t}}\sum _{n\leqslant H^t}\chi (n)\,dt\\&=\frac{\sum _{n\leqslant H^x}\chi (n)}{H^x}+\log H\int _0^{x}f(t)\,dt, \end{aligned}$$

which rearranges to the desired result.

Our aim is to majorize F(1). Define

$$\begin{aligned} \ell (y)=H^{-y}\sum _{n\leqslant H^y}\chi (n)\log n. \end{aligned}$$
(3)

It is also convenient to introduce the points

$$\begin{aligned} x_m=1-\frac{\log m}{\log H}. \end{aligned}$$
(4)

2 Preliminary results

We now list a trivial result that follows immediately from partial summation.

Lemma 3

When \(x\geqslant 0\), we have \(\sum _{n\leqslant x}1/\sqrt{n}\leqslant 2\sqrt{x}\).

The following result is slightly more subtle.

Lemma 4

When \(x\geqslant y\geqslant 1\), we have \(S(x, y):= \sum _{y\leqslant n\leqslant x}1/n\leqslant 1+\log (x/y)\).

Proof

First note that we only need to prove the result for y an integer. If \(y\notin {\mathbb {Z}}\), then

$$\begin{aligned} S(x, y) = S(x, [y] + 1) \leqslant 1 + \log \left( \frac{x}{[y] + 1}\right) < 1 + \log \left( \frac{x}{y}\right) . \end{aligned}$$

Similarly it suffices to prove the result for integral x. Assume, therefore, that \(y\geqslant x\geqslant 1\) where both \(x, y\in {\mathbb {Z}}\). We therefore have

$$\begin{aligned} S(x, y) = \frac{1}{y} + \sum _{n=y+1}^{x} \frac{1}{n} \leqslant 1 + \int _{x}^{y} \frac{dt}{t} = 1 + \log \left( \frac{x}{y}\right) , \end{aligned}$$

as required. \(\square \)

We now list some bounds related to the prime number theorem. In particular, we give a range of bounds for the Chebyshev function

$$\begin{aligned} \psi (x)=\sum _{p^k\leqslant x}\log p. \end{aligned}$$

The first is a classical result from Rosser and Schoenfeld, see [35, Thm 12].

Lemma 5

When \(x\geqslant 0\), we have \(\psi (x)\leqslant 1.04\,x\).

We note that the result of Rosser and Schoenfeld gives 1.03883 in Lemma 5, which is an approximation to \(\psi (113)/113\). To improve the bound in Lemma 5 it would be necessary to take \(x\geqslant x_{0} > 113\), which, while possible, would complicate greatly the ensuing analysis for only a marginal improvement.

The second is an explicit bound of the form \(\psi (x) -x = o(x)\) coming from [3, Table 15] by Broadbent, Kadiri, Lumley, Ng, and Wilk.

Lemma 6

When \(x\geqslant 10^5\), we have \(|\psi (x)-x|\leqslant 0.64673\,x/(\log x)^2\).

On the Riemann hypothesis we have \(\psi (x) -x = O(x^{1/2 + \epsilon })\) for every \(\epsilon >0\). The following result, from [5, Thm 2] of Büthe, gives an explicit version of an even sharper bound for a finite range.

Lemma 7

When \(11< x\leqslant 10^{19}\), we have \(|\psi (x)-x|\leqslant 0.94\sqrt{x}\).

We remark that slightly weaker versions of Lemma 7, but ones that hold in a longer range of x have been provided by the first author in [12]. We require the following result to be used in tandem with Lemma 7.

Lemma 8

When \(e^{40}\leqslant x\), we have \(|\psi (x)-x|\leqslant 1.994\cdot 10^{-8}\,x\).

This is obtained directly from [3, Table 8]. The key feature here is that \(e^{40}<10^{19}\) so that Lemma 7 and Lemma 8 between them cover all values of \(x> 11\). Better results are available when x is very large, say \(\log x \geqslant 1000\) — see [31] by Platt and Trudgian, and [13] by the first author and Yang — but Lemmas 7 and 8 suffice for our needs.

We now turn to estimates on

$$\begin{aligned} {\widetilde{\psi }}(u):= \sum _{n\leqslant u}\Lambda (n)/n \end{aligned}$$
(5)

to aid in the evaluation of \(h(\chi , y)\) and h(1, y) in (1). To obtain such estimates we correct a result of the second author in [34].

Lemma 9

For \(x\geqslant 71\) we have

$$\begin{aligned} \sum _{n\leqslant x}\frac{\Lambda (n)}{n}=\log x-\gamma +\frac{\psi (x)-x}{x}+\frac{0.047}{\sqrt{x}}+\frac{\log (2\pi )+10^{-4}}{x}+E(x), \end{aligned}$$

where \(\gamma \) is the Euler–Mascheroni constant, and where

$$\begin{aligned} E(x)= {\left\{ \begin{array}{ll} 1.75\cdot 10^{-12},&{}1\leqslant x< 2R\log ^2 T_0\\ \frac{1+2\sqrt{(\log x)/R}}{2\pi }\exp (-2\sqrt{(\log x)/R}), &{}x\geqslant 2R\log ^2 T_0, \end{array}\right. } \end{aligned}$$

withFootnote 1\(R=5.69693\) and \(T_0=2.44\cdot 10^{12}\).

Proof

As discussed by Chirre, Hagen, and Simonič in [6], by fixing a couple of small typos, Lemma 2.2 in [34] can be replaced by

$$\begin{aligned}&\sum _{n\leqslant x}\frac{\Lambda (n)}{n}=\log x-\gamma +\frac{\psi (x)-x}{x}-\sum _{\rho }\frac{x^{\rho -1}}{\rho (\rho -1)}\\&\quad +\int _x^\infty \frac{\log 2\pi +\frac{1}{2}\log (1-u^{-2})}{u^2}\textrm{d}u, \end{aligned}$$

where \(\rho \) runs over the non-trivial zeros of the Riemann zeta-function, counting multiplicity. Following [34, §5], we have

$$\begin{aligned} \left| \sum _{\rho }\frac{x^{\rho -1}}{\rho (\rho -1)}\right| \leqslant \frac{0.047}{\sqrt{x}}+E(x). \end{aligned}$$

Finally, since \(x\geqslant 71\),

$$\begin{aligned} \left| \int _x^\infty \frac{\log 2\pi +\frac{1}{2}\log (1-u^{-2})}{u^2}\textrm{d}u\right|&\leqslant \frac{\log (2\pi )}{x}+\frac{|\log (1-71^{-2})|}{2x}\\&\leqslant \frac{\log (2\pi )+10^{-4}}{x}. \end{aligned}$$

\(\square \)

Lemma 10

We have

$$\begin{aligned} \sum _{n\leqslant x}\frac{\Lambda (n)}{n}&={{\,\textrm{log}\,}}x-\gamma +\mathcal {O}^*(1.3/\log ^2x), \qquad x> 1, \end{aligned}$$
(6)
$$\begin{aligned} \sum _{n\leqslant x}\frac{\Lambda (n)}{n}&={{\,\textrm{log}\,}}x-\gamma +\mathcal {O}^*(1/\sqrt{x}), \qquad 1\leqslant x\leqslant 10^{19}. \end{aligned}$$
(7)

Proof

Using Lemma 9 with the bounds from Lemmas 6 and 7, we obtain that,

$$\begin{aligned} \sum _{n\leqslant x}\frac{\Lambda (n)}{n}=\log x-\gamma +\mathcal {O}^*\left( \frac{0.67}{\log ^2 x}\right) \end{aligned}$$

for \(x\geqslant 10^5\), and

$$\begin{aligned} \sum _{n\leqslant x}\frac{\Lambda (n)}{n}=\log x-\gamma +\mathcal {O}^*\left( \frac{1}{\sqrt{x}}\right) \end{aligned}$$

for \(10^5\leqslant x\leqslant 10^{19}\). We then extend these estimates to smaller values of x by direct computation, giving (6) and (7). \(\square \)

An immediate consequence of this result is as follows.

Lemma 11

We have

$$\begin{aligned}&\sum _{n\leqslant x}\frac{\Lambda (n)}{n} \leqslant {{\,\textrm{log}\,}}x-0.545, \qquad x\geqslant 10^3,\\&\sum _{n\leqslant x}\frac{\Lambda (n)}{n} \geqslant {{\,\textrm{log}\,}}x-0.576, \qquad x\geqslant 10^{6}. \end{aligned}$$

We now examine the weighted average of \(\sum _{n\leqslant u} \Lambda (n)/n\).

Lemma 12

We have

$$\begin{aligned} \int _1^\infty \biggl |\sum _{n\leqslant u}\frac{\Lambda (n)}{n}-\log u+\gamma \biggr |\frac{du}{u} \leqslant 0.411. \end{aligned}$$

This integral may be of interest in its own right. While the true value of this integral seems close to 0.41, we have no idea of the conjectured limiting value of the integral. To this end, see a similar problem discussed in [2].

Proof

We define \(\Delta (u)=\sum _{n\leqslant u}\Lambda (n)/n-\log u+\gamma \). When the variable u is small, we compute directly by using the fact that \({\widetilde{\psi }}(u)\) is constant on \([n,n+1)\) and that, with \(\tau ={\widetilde{\psi }}(n)+\gamma \), the integral \(\int _n^{n+1}|\Delta (u)|{du}/{u}\) is equal to

$$\begin{aligned} {\left\{ \begin{array}{ll} \frac{\log ^2(n+1)-\log ^2n}{2}-\tau \log \frac{n+1}{n} &{}\text {when }\tau \leqslant \log n,\\ \frac{\log ^2(n+1)+\log ^2n-2\tau ^2}{2}+\tau (2\tau -\log (n^2+n) &{}\text {when }\log n<\tau < \log (n+1),\\ -\frac{\log ^2(n+1)-\log ^2n}{2}+\tau \log \frac{n+1}{n} &{}\text {when } \tau \geqslant \log (n+1). \end{array}\right. } \end{aligned}$$

The second case is treated by splitting the integral at \(u=e^\tau \). We compute in this manner that

$$\begin{aligned} \int _{1}^{10^6}|\Delta (u)|\frac{du}{u} \leqslant 0.408. \end{aligned}$$

We use Lemma 10 to infer that

$$\begin{aligned} \int _{10^6}^{10^{19}}|\Delta (u)|\frac{du}{u} \leqslant \int _{10^6}^{10^{19}}\frac{1}{u^{3/2}}du\leqslant \frac{2}{\sqrt{10^6}} =\frac{2}{1000}=0.002. \end{aligned}$$

We now use Lemma 8 and Lemma 9 to show that, for some \(x_{1}\geqslant 10^{19}\),

$$\begin{aligned} \int _{10^{19}}^{x_{1}} |\Delta (u)| \frac{du}{u}&\leqslant \int _{10^{19}}^{x_{1}} \left( \frac{2\cdot 10^{-8}}{u} + \frac{0.05}{u^{3/2}}\right) \, du\\&= 2\cdot 10^{-8}(\log x_{1} - 19\log 10) + \frac{0.2}{\sqrt{10^{19}}} - \frac{0.2}{\sqrt{x_{1}}}. \end{aligned}$$

To handle the integration beyond \(x_{1}\) we use (6) in Lemma 10, whence the total integral is

$$\begin{aligned} 0.408 + 0.002 + 2\cdot 10^{-8}(\log x_{1} - 19\log 10) + \frac{0.2}{\sqrt{10^{19}}} - \frac{0.2}{\sqrt{x_{1}}} + \frac{1.3}{\log x_{1}}. \end{aligned}$$

Choosing \(x_{1} = \exp (500)\) gives the result. \(\square \)

We remark that we could further divide the range to use more entries in the tables in [3], but the above result is sufficient for our purposes.

3 Character sum estimates

The work of Stephens and Pintz relied on the Burgess bound from [4]. Explicit versions of this are known but are still numerically rather weak. When the modulus is prime, such bounds have been provided by Francis [8] improving on work by Treviño [38] and McGown [24]. If we restrict our attention here to quadratic characters to prime modulus congruent to 1 modulo 4, we may rely on the slightly stronger bounds of Booker in [1]. Recently, Jain-Sharma, Khale and Liu have produced in [11] an explicit version of the Burgess inequality for a composite modulus, but only for q primitive and \(q\geqslant \exp (\exp (9.6))\).

Instead of the Burgess bound we shall rely on versions of the Pólya–Vinogradov inequality. We first require an explicit version of the Pólya–Vinogradov inequality.

The following is from [18, 19] by Lapkova, which makes a small improvement on the earlier result from [9, Theorem 2] by Frolenkov and Soundararajan.

Lemma 13

When \(q>1\) and \(\chi \) is a primitive Dirichlet character modulo q, we have

$$\begin{aligned} \biggl |\sum _{A\leqslant n\leqslant B}\chi (n)\biggr | \leqslant V(\chi ) = {\left\{ \begin{array}{ll} \frac{2}{\pi ^2}\sqrt{q}\log q+0.9467\sqrt{q} + 1.668,\, &{}\text {when }\chi (-1)=1,\\ \frac{1}{2\pi }\sqrt{q}\log q+0.8204\sqrt{q} + 1.0286, \, &{}\text {when } \chi (-1)=-1. \end{array}\right. } \end{aligned}$$

When \(A=0\) and \(\chi \) is even, we may divide this bound by 2.

In what follows, we write \(V= V(\chi )\) for brevity, and apply the appropriate bound from Lemma 13 according to the parity of the character \(\chi \).

Here is a smoothed version of the Pólya–Vinogradov inequality that we take from Levin, Pomerance and Soundararajan in [20].

Lemma 14

Let \(\chi \) be a primitive Dirichlet character modulo \(q>1\). Let M and N be real numbers with \(0<N\leqslant q\). With \(W(t)=\max (0,1-|t-1|)\), we have

$$\begin{aligned} \biggl |\sum _{M\leqslant n\leqslant M+2N}\chi (n) W\biggl (\frac{n-M}{N}\biggr ) \biggr | \leqslant \sqrt{q}-\frac{N}{\sqrt{q}}. \end{aligned}$$

Lemma 15

Let \(\chi \) be a primitive Dirichlet character modulo \(q>1\). Let M and N be real numbers with \(0<N\leqslant q\). When \(\chi \) is odd,we have

$$\begin{aligned} \biggl |\sum _{M< n\leqslant M+N}\chi (n) \biggr | \leqslant \sqrt{2N}q^{1/4}+\sqrt{q}. \end{aligned}$$

When \(\chi \) is even, we have

$$\begin{aligned} \biggl |\sum _{n\leqslant N}\chi (n) \biggr | \leqslant \sqrt{N}q^{1/4}+\tfrac{1}{2}\sqrt{q}. \end{aligned}$$

Proof

We may assume that M is an integer. Notice first that the lemma is trivial when \(N\leqslant \sqrt{q}\), so we may assume \(N>\sqrt{q}\). Let \(K\geqslant 1\) be an integer and let \(A=N/K\). Keeping the notation of Lemma 14, we first notice that

$$\begin{aligned}{} & {} W\biggl (\frac{t-(M-A/2)}{A}\biggr ) +W\biggl (\frac{t-(M+A/2)}{A}\biggr ) +\ldots + W\biggl (\frac{t-(M+(K-1/2)A)}{A}\biggr )\\{} & {} \quad = {\left\{ \begin{array}{ll} W\biggl (\frac{t-(M-A/2)}{A}\biggr ) &{}\text {when }M-{A}/{2}\leqslant t\leqslant M+A/2,\\ 1&{}\text {when }M+A/2\leqslant t\leqslant M+(K+1/2)A,\\ W\biggl (\frac{t-(M+(K-1/2)A)}{A}\biggr ) &{}\text {when }M+(K-1/2)A\leqslant t\leqslant M+(K+1/2)A. \end{array}\right. } \end{aligned}$$

Therefore

$$\begin{aligned} \biggl |\sum _{M< n\leqslant M+N}\chi (n) -\sum _{1\leqslant k\leqslant K}\sum _{n}\chi (n)W\biggl (\frac{t-(M+(k-1/2)A)}{A}\biggr ) \biggr | \leqslant \frac{4}{A}\sum _{1\leqslant a\leqslant A/2}a \end{aligned}$$

which is readily seen to be of size at most \(\frac{A}{2}+1\). On using Lemma 14, we get

$$\begin{aligned} \biggl |\sum _{M< n\leqslant M+N}\chi (n) \biggr | \leqslant K\sqrt{q}-\frac{KA}{\sqrt{q}} +\frac{A}{2}+1 \leqslant K\sqrt{q}-\frac{N}{\sqrt{q}} +\frac{N}{2K}+1. \end{aligned}$$

We let \(K=1+[q^{-1/4}\sqrt{N/2}]\) and write \(K = c + q^{-1/4}\sqrt{N/2}\) with \(c\in (0,1]\). We find that

$$\begin{aligned} K\sqrt{q} +\frac{N}{2K} = \sqrt{\frac{N\sqrt{q}}{2}} +c\sqrt{q} + \frac{N}{2c + q^{-1/4}\sqrt{2N}}. \end{aligned}$$

By computing the derivative with respect to c, we check that this quantity is maximised at \(c=1\). The lemma follows readily. \(\square \)

Before introducing the next lemma, we recall the functions Ff defined in (2).

Lemma 16

We have \( L(1,\chi )=F(1)\log H+\mathcal {O}^*(VH^{-1})\), where V is defined in Lemma 13.

Proof

By summation by parts, we find that

$$\begin{aligned} \sum _{n>H}\frac{\chi (n)}{n}&= \int _H^\infty \sum _{H\leqslant n\leqslant t}\chi (n)\frac{dt}{t^2}, \end{aligned}$$

hence

$$\begin{aligned} L(1,\chi )&= F(1)\log H+f(1)+\int _H^\infty \sum _{H\leqslant n\leqslant t}\chi (n)\frac{dt}{t^2}\\&= F(1)\log H+\sum _{n\leqslant H}\int _H^\infty \frac{dt}{t^2}+\int _H^\infty \sum _{H\leqslant n\leqslant t}\chi (n)\frac{dt}{t^2}\\&= F(1)\log H+\int _H^\infty \sum _{ n\leqslant t}\chi (n)\frac{dt}{t^2}=F(1)\log H+\mathcal {O}^*(V/H). \end{aligned}$$

\(\square \)

4 Preliminaries to Stephens’ approach

Using the definition of f(x) from (2) in § 1, we have

$$\begin{aligned} \sum _{m\leqslant H^x}\frac{\chi (m)\Lambda (m)}{m}f\biggl (x-\frac{\log m}{\log H}\biggr )&=\frac{1}{H^x}\sum _{m\leqslant H^x}\chi (m)\Lambda (m)\sum _{n\leqslant H^x/m}\chi (n)\\&=\frac{1}{H^x}\sum _{m\leqslant H^x}\Lambda (m)\sum _{mn\leqslant H^x}\chi (mn). \end{aligned}$$

Now, \(\Lambda (m)\) is only non-zero when m is a prime power, so

$$\begin{aligned} \frac{1}{H^x}\sum _{m\leqslant H^x}\Lambda (m)\sum _{mn\leqslant H^x}\chi (mn)&=\frac{1}{H^x}\sum _{p^k\leqslant H^x}\log p\sum _{p^kn\leqslant H^x}\chi (p^kn). \end{aligned}$$
(8)

We now write \(s=\prod _ip_i\alpha ^i\) as the prime decomposition for each \(s\leqslant H^x\), so that (8) becomes

$$\begin{aligned} \frac{1}{H^x}\sum _{s\leqslant H^x}\chi (s)\sum _{i}\alpha _i\log (p_i)=\frac{1}{H^x}\sum _{s\leqslant H^x}\chi (s)\log s=\ell (x), \end{aligned}$$

using the definition of \(\ell (x)\) from (3). We therefore have

$$\begin{aligned} \ell (x)=\sum _{m\leqslant H^x}\frac{\chi (m)\Lambda (m)}{m}f\biggl (x-\frac{\log m}{\log H}\biggr ). \end{aligned}$$
(9)

We now recast this for greater ease of use in what follows.

Lemma 17

We have, for \(x\geqslant 0\),

$$\begin{aligned} \frac{\ell (x)}{\log H}=xf(x)-H^{-x}\int _0^x f(u)H^udu. \end{aligned}$$

If \(H\geqslant V> 1\) we also have \(\int _0^1 f(u)H^udu/H=\mathcal {O}^*(1/\log H)\) and

$$\begin{aligned} \sum _{m\leqslant H}\frac{\chi (m)\Lambda (m)}{m\log H}f(x_m) = f(1)+\mathcal {O}^*\biggl (\frac{R_\chi (H,V,q)}{\log H}\biggr ), \end{aligned}$$
(10)

where

$$\begin{aligned} R_\chi (H,V,q)= {\left\{ \begin{array}{ll} (3.66+\log (V^2/q))\frac{\sqrt{q}}{H} +\log (4e^2\sqrt{q}H/V^2)\frac{V}{2H} &{}\text {when }\chi (-1)=1,\\ (7.2+\log (V^2/q))\frac{\sqrt{q}}{H} +\log (2e^2\sqrt{q}H/V^2)\frac{V}{H} &{}\text {when }\chi (-1) = -1. \end{array}\right. }\nonumber \\ \end{aligned}$$
(11)

We note that the proofs of Theorems 1 and 2 only require the upper bound in the \(\mathcal {O}^{*}\) error term in (10): see (17) for where this is used. Nevertheless, it is easy enough to prove (10) as it is written.

Proof

We find that

$$\begin{aligned} \sum _{k\leqslant H^x}\chi (k)\log k&= \sum _{k\leqslant H^x}\chi (k)\log (H^x) -\sum _{k\leqslant H^x}\chi (k)\int _k^{H^x}\frac{dt}{t}\\&= H^xxf(x)\log H -\int _1^{H^x}f\Bigl (\frac{\log t}{\log H}\Bigr )t\frac{dt}{t}\\&= H^xxf(x)\log H -\int _0^{x}f(u)(\log H)H^udu \end{aligned}$$

and the first part of the lemma follows readily. Concerning the upper bound for \(|\int _0^1 f(u)H^udu|/H\), we proceed as follows.

4.1 Case of even characters

By Lemma 13 and 15, we have three upper bounds for |f(u)|: either 1, \(q^{1/4}H^{-u/2}+\frac{1}{2}q^{1/2}H^{-u}\) or \(V/(2H^u)\). We have \(q^{1/4}H^{-u/2}+\frac{1}{2}q^{1/2}H^{-u}\leqslant 1\) when \(H^u/\sqrt{q}\geqslant 1+\sqrt{3}\). We momentarily set \({\tilde{V}}=V/2\). We define

$$\begin{aligned} u_0= \frac{\log (1+\sqrt{3})+\frac{1}{2}\log q}{\log H}. \end{aligned}$$

Define the real parameter a by \(\frac{1}{2}(1-a)\log H=\log (\sqrt{\sqrt{q}H}/{\tilde{V}})\). We get

$$\begin{aligned} \int _0^1 |f(u)|H^udu&\leqslant \int _0^{u_0} H^udu+\int _{u_0}^a (q^{1/4}H^{u/2}+\tfrac{1}{2}q^{1/2})du +\int _a^1{\tilde{V}}du\\&\leqslant \frac{H^{u_0}-1}{\log H}+\frac{2q^{1/4}(H^{a/2}-H^{u_0/2})}{\log H} +\frac{a-u_0}{2}q^{1/2}+(1-a){\tilde{V}}\\&\leqslant \frac{\sqrt{q}}{\log H} \bigl (1+\sqrt{3}+2\sqrt{1+\sqrt{3}}\bigr ) +\frac{2q^{1/4}\sqrt{H}}{\log H}\frac{{\tilde{V}}}{\sqrt{\sqrt{q}H}}\\&\qquad +\frac{\log \frac{{\tilde{V}}^{2}}{q(1+\sqrt{3})}}{\log H} \sqrt{q} +\frac{\log (\sqrt{q}H/{\tilde{V}}^{2})}{\log H}{\tilde{V}}\\&\quad \leqslant \frac{\sqrt{q}}{\log H} \left( 1+\sqrt{3}+2\sqrt{1+\sqrt{3}} +\log \frac{{\tilde{V}}^{2}}{q(1+\sqrt{3})}\right) \\&\qquad +\frac{2{\tilde{V}}}{\log H}+\frac{\log (\sqrt{q}H/{\tilde{V}}^{2})}{\log H}{\tilde{V}}. \end{aligned}$$

4.1.1 Case of odd characters

Again by Lemma 13 and 15, we have three upper bounds for |f(u)|: either 1, \(q^{1/4}\sqrt{2}H^{-u/2}+q^{1/2}H^{-u}\) or \(V/H^u\). We have \(q^{1/4}\sqrt{2}H^{-u/2}+q^{1/2}H^{-u}\leqslant 1\) when \(H^u/\sqrt{q}\geqslant 2+\sqrt{3}\). We define

$$\begin{aligned} u_0= \frac{\log (2+\sqrt{3})+\frac{1}{2}\log q}{\log H}. \end{aligned}$$

Define the real parameter a by \(\frac{1}{2}(1-a)\log H=\log (\sqrt{2\sqrt{q}H}/V)\). We get

$$\begin{aligned} \int _0^1 |f(u)|H^udu&\leqslant \int _0^{u_0} H^udu+\int _{u_0}^a (q^{1/4}\sqrt{2}H^{u/2}+q^{1/2})du +\int _a^1Vdu\\&\leqslant \frac{H^{u_0}-1}{\log H}+\frac{2\sqrt{2}q^{1/4}(H^{a/2}-H^{u_0/2})}{\log H} +(a-u_0)q^{1/2}+(1-a)V\\&\leqslant \frac{\sqrt{q}}{\log H} \bigl (2+\sqrt{3}+2\sqrt{2}\sqrt{2+\sqrt{3}}\bigr ) +\frac{2\sqrt{2}q^{1/4}\sqrt{H}}{\log H}\frac{V}{\sqrt{2\sqrt{q}H}}\\&\qquad +\frac{\log \frac{V^2}{2q(2+\sqrt{3})}}{\log H} \sqrt{q} +\frac{\log (2\sqrt{q}H/V^2)}{\log H}V\\&\leqslant \frac{\sqrt{q}}{\log H} \bigl (2+\sqrt{3}+2\sqrt{2}\sqrt{2+\sqrt{3}} +\log \frac{V^2}{2q(2+\sqrt{3})}\bigr )\\&\qquad +\frac{2V}{\log H}+\frac{\log (2\sqrt{q}H/V^2)}{\log H}V. \end{aligned}$$

4.1.2 Resuming the proof

Inequality (10) follows: indeed, by (9), the left-hand side is \(\ell (1)/\log H\) which we compute with the first formula of the present lemma. We complete the proof by using the bound above for \(\int _0^1 |f(u)|H^udu\). \(\square \)

Lemma 18

We have, for \(x\geqslant 0\),

$$\begin{aligned}{} & {} \biggl (x-\frac{1}{\log H}\biggr )F(x) =\int _0^x F(x-y)dy\\{} & {} \quad +\sum _{m\leqslant H^x}\frac{\chi (m)\Lambda (m)}{m\log H} F\biggl (x-\frac{\log m}{\log H}\biggr )+\mathcal {O}^*(1/\log ^2 H). \end{aligned}$$

Proof

On joining (9) and Lemma 17, we get

$$\begin{aligned} xf(x)-H^{-x}\int _0^x f(u)H^udu = \sum _{m\leqslant H^x}\frac{\chi (m)\Lambda (m)}{m\log H}f\biggl (x-\frac{\log m}{\log H}\biggr ). \end{aligned}$$

This is the equivalent of [37, (55)] by Stephens. The next step is to integrate the above relation:

$$\begin{aligned} \int _0^x yf(y)dy-\int _0^x\int _0^y f(u)H^{u-y}dudy&=\int _0^x\sum _{m\leqslant H^y}\frac{\chi (m)\Lambda (m)}{m\log H}f\biggl (y-\frac{\log m}{\log H}\biggr )dy\\&=\sum _{m\leqslant H^x}\frac{\chi (m)\Lambda (m)}{m\log H} \int _{\frac{\log m}{\log H}}^x f\biggl (y-\frac{\log m}{\log H}\biggr )dy\\&=\sum _{m\leqslant H^x}\frac{\chi (m)\Lambda (m)}{m\log H} F\biggl (x-\frac{\log m}{\log H}\biggr ). \end{aligned}$$

As for the left-hand side, we first check that

$$\begin{aligned} \int _0^x yf(y)dy = xF(x)-\int _0^x F(x-y)dy. \end{aligned}$$

And finally

$$\begin{aligned} \int _0^x\int _0^y f(u)H^{u-y}dudy&= \int _0^xf(u)H^{u}\int _u^x H^{-y}dydu\\&= \int _0^xf(u)H^{u}\frac{H^{-u}-H^{-x}}{\log H}du =\frac{F(x)}{\log H}+\mathcal {O}^*\left( \frac{1}{\log ^2H}\right) \end{aligned}$$

by bounding |f(u)| by 1. \(\square \)

Lemma 19

We have, when \(x\geqslant 0\)

$$\begin{aligned} \int _0^x F(x-y)dy= \sum _{m\leqslant H^x}\frac{\Lambda (m)}{m\log H} F\biggl (x-\frac{\log m}{\log H}\biggr )-F(x)\frac{\gamma }{\log H}+\mathcal {O}^*\biggl (\frac{0.411}{\log ^2 H}\biggr ). \end{aligned}$$

Proof

We start from the right-hand side:

$$\begin{aligned} \sum _{m\leqslant H^x}\frac{\Lambda (m)}{m\log H} F\biggl (x-\frac{\log m}{\log H}\biggr )&= \sum _{m\leqslant H^x}\frac{\Lambda (m)}{m\log H} \int _0^{x-\frac{\log m}{\log H}}f(t)dt\\&= \int _0^{x}f(t) \sum _{m\leqslant H^{x-t}}\frac{\Lambda (m)}{m\log H} dt. \end{aligned}$$

Recall \({\widetilde{\psi }}\) from (5). We approximate \({\widetilde{\psi }}(H^{x-t})\) by \((x-t)\log H-\gamma \), getting the main term and this is \(\int _0^xF(t)dt-F(x)\frac{\gamma }{\log H}\) and treat the error term by bounding |f(t)| by 1:

$$\begin{aligned} \int _0^{x}\biggl |f(t) \biggl (\frac{{\widetilde{\psi }}(H^{x-t})}{\log H}-\left( x-t-\frac{\gamma }{\log H}\right) \biggr )\biggr |dt&\leqslant \int _0^{x}\biggl | \frac{{\widetilde{\psi }}(H^{x-t})}{\log H}-\left( x-t-\frac{\gamma }{\log H}\right) \biggr |dt\\&\leqslant \int _0^{x}\biggl | \frac{{\widetilde{\psi }}(H^{t})}{\log H}-t+\frac{\gamma }{\log H}\biggr |dt\\&\leqslant \int _1^{H^x}| {\widetilde{\psi }}(u)-\log u+\gamma |\frac{du}{u\log ^2H}. \end{aligned}$$

We then majorize this last term by Lemma 12. If follows from the definition of F in (2) that this last term is not more than \(0.411/\log ^2H\). \(\square \)

Lemma 20

We have, when \(x\geqslant 0\),

$$\begin{aligned} xF(x)= \sum _{m\leqslant H^x}\frac{\Lambda (m)(1+\chi (m))}{m\log H} F\biggl (x-\frac{\log m}{\log H}\biggr ) +F(x)\frac{1-\gamma }{\log H}+\mathcal {O}^*\biggl (\frac{1.411}{\log ^2 H}\biggr ). \end{aligned}$$

Proof

This follows by combining Lemmas 18 and  19. \(\square \)

5 A comparison and the main inequality

This section is devoted to the comparison between

$$\begin{aligned} \sum _{m\leqslant H}\frac{\Lambda (m)}{m\log H} f(x_m) \end{aligned}$$
(12)

and F(1), where \(x_{m}\) is defined in (4). The important observation, essentially due to Stephens, is that since f has tame variations, both should be about equal. In § 7, where we prove Theorems 1 and 2, we need only to bound (12) from below by F(1) plus some error term.

We first connect F(1) with the bounds on character sums, that is, with the V from Lemma 13.

Lemma 21

We have, for any \(D\geqslant 1\),

$$\begin{aligned} F(1)=\sum _{n\leqslant H/D}\frac{\chi (n)}{n\log H} -\frac{f(1)}{\log H}+\mathcal {O}^*\biggl (\frac{(D-1)V/H}{\log H}\biggr ). \end{aligned}$$

Proof

We have

$$\begin{aligned} \sum _{H/D<n\leqslant H}\frac{\chi (n)}{n}&= \sum _{H/D<n\leqslant H}\chi (n)\biggl (\int _n^H\frac{dt}{t^2}+\frac{1}{H}\biggr )\\&= \int _{H/D}^H\sum _{H/D<n\leqslant t}\chi (n)\frac{dt}{t^2}+\frac{1}{H}\sum _{H/D<n\leqslant H}\chi (n). \end{aligned}$$

Using that \(|\sum _{A\leqslant n \leqslant B} \chi (n)| \leqslant V\) yields the desired result. \(\square \)

Lemma 22

Let \(D_0\geqslant 1\), and \(A_2\) be such that

$$\begin{aligned} |\psi (x)-x|\leqslant A_2\sqrt{x},\quad D_0\leqslant x\leqslant 10^{19}. \end{aligned}$$
(13)

We then have, for any \(D\geqslant D_0\),

$$\begin{aligned} \sum _{mn\leqslant H}\chi (n)\Lambda (m)= & {} H\bigl (F(x_D)\log H+f(x_D)\bigr ) \\{} & {} +\mathcal {O}^*\bigl (1.6\cdot 10^{-5} H+2A_2HD^{-1/2}+1.04DV\bigr ). \end{aligned}$$

Please notice that we would need only the lower estimate in the last bound.

Proof

We write

$$\begin{aligned} \sum _{mn\leqslant H}\chi (n)\Lambda (m)&=\sum _{n\leqslant H/2}\chi (n)\sum _{m\leqslant H/n}\Lambda (m)\nonumber \\&=\sum _{n\leqslant H/D}\chi (n)\sum _{m\leqslant H/n}\chi (m)+\sum _{m\leqslant D}\Lambda (m)\sum _{H/D<n\leqslant H/m}\chi (n). \end{aligned}$$
(14)

By Lemma 3, the last sum over n is bounded in absolute value by V. It then follows by Lemma 5 that the second summand of (14) satisfies

$$\begin{aligned} \sum _{m\leqslant D}\Lambda (m)\sum _{H/D<n\leqslant H/m}\chi (n)\leqslant 1.04DV. \end{aligned}$$

Concerning the first summand of (14), we use three steps. For the first step, we restrict to the range \(H/10^{19}<n\leqslant H/D\) and use (13). Note that Lemma 7 tells us that we can take \(A_2=0.94\) provided \(D_0>11\). A quick calculation also shows that \(A_2=\sqrt{2}\) works for \(D_0\geqslant 1\), or \(A_2=0.956\) works for \(D_0\geqslant 7\). Now,

$$\begin{aligned}&\sum _{H/10^{19}<n\leqslant H/D}\chi (n)\sum _{m\leqslant H/n}\Lambda (m)\\&\quad =\sum _{H/10^{19}<n\leqslant H/D}\chi (n)\sum _{m\leqslant H/n}\Lambda (m)\\&\quad =H\sum _{H/10^{19}<n\leqslant H/D}\frac{\chi (n)}{n} +{\mathcal {O}}^*\left( \sum _{H/10^{19}<n\leqslant H/D} A_2\sqrt{\frac{H}{n}}\right) \\&\quad =H\sum _{H/10^{19}<n\leqslant H/D}\frac{\chi (n)}{n} +{\mathcal {O}}^*\left( 2A_2HD^{-1/2}\right) , \end{aligned}$$

where for the second equality we used Lemma 3.

For the second step, we use Lemma 8 and consider the range \(H/A<n\leqslant H/10^{19}\), where \(A\geqslant \exp (40)\) is to be chosen later. That is,

$$\begin{aligned}&\sum _{H/A<n\leqslant H/10^{19}} \chi (n)\sum _{m\leqslant H/n}\Lambda (m)\nonumber \nonumber \\&\quad =H\sum _{H/A<n\leqslant H/10^{19}}\frac{\chi (n)}{n}+{\mathcal {O}}^*\left( 1.93378\cdot 10^{-8}\sum _{H/A<n\leqslant H/10^{19}}\frac{H}{n}\right) \nonumber \\&\quad =H\sum _{H/A<n\leqslant H/10^{19}}\frac{\chi (n)}{n}+{\mathcal {O}}^*\left( 1.93378\cdot 10^{-8}(1+\log (A/10^{19}))H\right) , \end{aligned}$$
(15)

where for the second equality we used Lemma 4.

For the third step we consider the sum over \(n\leqslant H/A\). First, if \(H<A\) then there is nothing to add. On the other hand, if \(H\geqslant A\) we use Lemma 6 to get

$$\begin{aligned} \sum _{n\leqslant H/A}\chi (n)\sum _{m\leqslant H/n}\Lambda (m)=H\sum _{n\leqslant H/A}\frac{\chi (n)}{n}+{\mathcal {O}}^*\left( \sum _{n\leqslant H/A}\frac{1.83H}{n\log ^2(H/n)}\right) . \end{aligned}$$
(16)

Since \(n\log ^2 (H/n)\) is increasing when \(n\leqslant H/e^2\), we have that

$$\begin{aligned} \sum _{n\leqslant H/A}\frac{1.83H}{n\log ^2(H/n)}&\leqslant \frac{1.83H}{\log ^2H}+H\int _{1}^{H/A}\frac{1.83dt}{t\log ^2(H/t)}\\&\leqslant \frac{1.83H}{\log ^2H}+1.83H\left( \frac{1}{\log A}-\frac{1}{\log H}\right) \\&=1.83H\left( \frac{1}{\log ^2H}+\frac{1}{\log A}-\frac{1}{\log H}\right) . \end{aligned}$$

Since the above is decreasing in H, and \(H\geqslant A\), we can set \(A=\exp (574)\) to bound the \({\mathcal {O}}^*\) terms in (15) and (16) by \(1.6\cdot 10^{-5}H\). \(\square \)

Lemma 23

For any \(D\geqslant D_{0}\geqslant 1\)

$$\begin{aligned} \left| \sum _{m\leqslant H}\frac{\Lambda (m)}{m\log H}f(x_m)-F(1)-\frac{f(1)}{\log H}\right| \leqslant \frac{1.6\cdot 10^{-5}+2A_2D^{-1/2}+(2.04D-1)VH^{-1}}{\log H}, \end{aligned}$$

where \(A_{2}\) is as in Lemma 22.

Proof

By using the definition of f, we get

$$\begin{aligned} \sum _{m\leqslant H}\frac{\Lambda (m)}{m\log H} f(x_m) = \sum _{mn\leqslant H}\frac{\chi (n)\Lambda (m)}{H\log H} \end{aligned}$$

and we appeal to Lemma 22. This leads to

$$\begin{aligned} \sum _{m\leqslant H}\frac{\Lambda (m)}{m\log H} f(x_m) = \sum _{n\leqslant H/D}\frac{\chi (n)}{n\log H}+\mathcal {O}^*\biggl ( \frac{1.6\cdot 10^{-5}+2A_2D^{-1/2}+1.04DVH^{-1}}{\log H} \biggr ). \end{aligned}$$

Note further that, by Lemma 21 (we need only the upper estimate), we have

$$\begin{aligned} F(1)=\sum _{n\leqslant H/D}\frac{\chi (n)}{n\log H} -\frac{f(1)}{\log H}+\mathcal {O}^*\biggl (\frac{(D-1)V}{H\log H}\biggr ). \end{aligned}$$

\(\square \)

We are now in a position to prove the following crucial lemma. Recall the definitions of h(1, x) and \(h(\chi , x)\) from (1), and of \(R_{\chi }(H, V, q)\) from (11).

Lemma 24

Let \(H\geqslant 10^6\) and \(x\geqslant 1/2\). Then we have

$$\begin{aligned} 0\leqslant \frac{h(1,x)+ h(\chi ,x)}{\log H}\leqslant 2x. \end{aligned}$$

Also, if H also satisfies \(H\geqslant V\),

$$\begin{aligned} \begin{aligned} \frac{h(1,x)+ h(\chi ,x)}{\log H}&\leqslant 2-F(1) + f(1)-\frac{f(1)}{\log H}\\&\quad +\frac{-1.15+3.81A_2^{2/3}(V/H)^{1/3}-VH^{-1}+R_\chi (H,V,q)}{\log H}, \end{aligned} \end{aligned}$$

where \(A_2\) is as in Lemma 22 when D is taken to be \(\left( \frac{A_2}{2.04}\frac{H}{V}\right) ^{2/3}\) (see (19)).

This is the equivalent of [37, Lemma 2] by Stephens.

Proof

The first inequality follows by Lemma 11. Concerning the second one, we proceed as follows. Define

$$\begin{aligned} S=\sum _{m\leqslant H}\frac{\Lambda (m)}{m\log H} \bigl (1-f(x_m)\bigr ) -\sum _{m\leqslant H}\frac{\chi (m)\Lambda (m)}{m\log H} \bigl (1-f(x_m)\bigr ). \end{aligned}$$
(17)

Since \(|\chi (m)|\), \(|f(x_m)|\leqslant 1\), we have \(S\geqslant 0\). Furthermore, on expanding and using the second part of Lemma 17, we find that

$$\begin{aligned} S= & {} \sum _{m\leqslant H}\frac{\Lambda (m)}{m\log H} -\sum _{m\leqslant H}\frac{\Lambda (m)}{m\log H} f(x_m) \\{} & {} -\frac{h(\chi ,1)}{\log H}+ f(1) +\mathcal {O}^*\biggl (\frac{R_\chi (H,V,q)}{\log H}\biggr ). \end{aligned}$$

Now we use Lemma 23. Since \(S\geqslant 0\), this leads to the inequality

$$\begin{aligned} \begin{aligned} \frac{h(\chi ,1)}{\log H}&\leqslant \frac{h(1,1)}{\log H}-F(1)-\frac{f(1)}{\log H} + f(1)\\&\quad +\frac{1.6\cdot 10^{-5}+2A_2D^{-1/2}+(2.04D-1)VH^{-1}+R_\chi (H,V,q)}{\log H}. \end{aligned} \end{aligned}$$
(18)

We select

$$\begin{aligned} D=\Bigl (\frac{A_2}{2.04}\frac{H}{V}\Bigr )^{2/3} \end{aligned}$$
(19)

so that the expression in ((18)) involving D is minimised. This then gives

$$\begin{aligned} \begin{aligned} \frac{h(\chi ,1)}{\log H}&\leqslant \frac{h(1,1)}{\log H}-F(1)-\frac{f(1)}{\log H} + f(1)\\&\quad +\frac{1.6\cdot 10^{-5}+3.81A_2^{2/3}(V/H)^{1/3}-VH^{-1}+R_\chi (H,V,q)}{\log H}. \end{aligned} \end{aligned}$$

Let us extend this inequality to \(h(\chi ,x)\). We simply write

$$\begin{aligned} h(\chi ,x)&=h(\chi ,1)-\sum _{H^x<m\leqslant H}\frac{\chi (m)\Lambda (m)}{m}\\&\quad \leqslant h(\chi ,1)+h(1,1)-h(1,x), \end{aligned}$$

hence the result, since \(2h(1,1)/\log H\leqslant 2-2\times 0.576/\log H\) by Lemma 11 and \(1.6\cdot 10^{-5} -2\times 0.576\leqslant -1.15\). \(\square \)

6 A result in optimization

This section contains a refined version of a result by Stephens: see Theorem 4 in [37]. No further arithmetical material is being introduced. We start with a technical lemma.

Lemma 25

We have, for \(\theta \) fixed and \(\theta \in (0, x)\),

$$\begin{aligned}{} & {} -4\int _\theta ^x(x-u)\log u\, du + 2\int _{x-\theta }^\theta udu+\int _\theta ^x 2\theta du\\{} & {} \quad =2x(x-x\log x-\theta ) +(2x-\theta )\theta (1+2\log \theta ). \end{aligned}$$

Proof

Notice that \(2\int u\log u du=u^2\log u-(u^2/2)\) and thus

$$\begin{aligned} 4\int _\theta ^x(x-u)\log u\, du&=4x(x\log x-x-\theta \log \theta +\theta )-2x^2\log x+x^2+2\theta ^2\log \theta -\theta ^2\\&=4x(-\theta \log \theta +\theta )+2x^2\log x-3x^2+2\theta ^2\log \theta -\theta ^2. \end{aligned}$$

Next,

$$\begin{aligned} 2\int _{x-\theta }^\theta udu+\int _\theta ^x 2\theta du =\theta ^2-(x-\theta )^2+2\theta (x-\theta )=-x^2+4x\theta -2\theta ^2, \end{aligned}$$

and thus

$$\begin{aligned}{} & {} -4\int _\theta ^x(x-u)\log u\, du + 2\int _{x-\theta }^\theta udu+\int _\theta ^x 2\theta du \\{} & {} \quad = 4x(\theta \log \theta -\theta )-2x^2\log x+3x^2-2\theta ^2\log \theta +\theta ^2 -x^2+4x\theta -2\theta ^2, \end{aligned}$$

whence the lemma follows after some simple algebraic rearrangement. \(\square \)

Lemma 26

Let \(H>1\) be a real parameter. Suppose we are given a sequence of non-negative real numbers \((u_m)_{1\leqslant m\leqslant H}\) and a continuous function G over [0, 1]. Assume we have, for every \(x\in [0,1]\), that

figure a

that for some parameters a and \(\varepsilon _2\), we have, when \(x\geqslant 1/2\),

figure b

that

figure c

and that, for some parameter \(\varepsilon _1\) we have, when \(x\geqslant 1/2\),

figure d

Then either \(G(1)\leqslant 2(1-1/\sqrt{e})\) or

$$\begin{aligned} 2a\theta \log \theta - 2\theta (1/\sqrt{e}-\theta )(2+\log \theta ) +\varepsilon _1+\varepsilon _2\geqslant 0, \end{aligned}$$

where \(\theta =1-G(1)/2\) belongs to \([1/2,1/\sqrt{e}]\).

Proof

Set

$$\begin{aligned} \theta =1-G(1)/2,\quad \varphi (y)=2(y-y\log y-\theta ). \end{aligned}$$

The function \(\varphi \) is increasing (its derivative is \(-2\log y\)) on (0, 1] and takes the positive value \(-2\theta \log \theta \) at \(y=\theta \). Note that \(\theta \geqslant 1/2\) since \(G(1)\leqslant 1\), and that when \(\theta \geqslant 1/\sqrt{e}\), our result is immediate. Let us assume that \(\theta < 1/\sqrt{e}\) so that \(\theta +2\theta \log \theta <0\). Assume that, when \(\theta \leqslant y\leqslant Z\), we have \(G(y)\leqslant \varphi (y)\). This latter inequality translates into

$$\begin{aligned} G(1)-G(y)\geqslant 2(1-y+y\log y). \end{aligned}$$

Our initial remark is that \(\theta \) is such a number.

Proof

Indeed, if it where not, we would have

$$\begin{aligned} G(1)=G(\theta )+G(1)-G(\theta )\leqslant \theta + 2(1-\theta +\theta \log \theta ) \end{aligned}$$

since \(G(x)\leqslant x\). We notice next that \(G(1)=2-2\theta \), so that the above inequality can be rewritten as \(G(1)\leqslant G(1)+\theta +2\theta \log \theta <G(1)\) by the inequality assumed for \(\theta \), leading to a contradiction. \(\square \)

We define for this proof

$$\begin{aligned} g(y)=\sum _{m\leqslant H^y}\frac{u_m}{\log H}. \end{aligned}$$
(20)

We find that, for \(Z\geqslant x\geqslant \theta \),

$$\begin{aligned}{} & {} \sum _{m\leqslant H^x}\frac{u_m}{\log H} G\biggl (x-\frac{\log m}{\log H}\biggr ) \leqslant \sum _{m\leqslant H^{x-\theta }}\frac{u_m}{\log H} \varphi \biggl (x-\frac{\log m}{\log H}\biggr ) \\{} & {} \quad + \sum _{H^{x-\theta }<m\leqslant H^x}\frac{u_m}{\log H} \biggl (x-\frac{\log m}{\log H}\biggr ) \end{aligned}$$

by bounding above G(y) by y by \((H_0\)) when \(y\leqslant \theta \). We study separately the two right-hand side sums, say \(S_1\) and \(S_2\). First we note that, on recalling the definition (20) of g:

$$\begin{aligned} S_1&= \sum _{m\leqslant H^{x-\theta }}\frac{u_m}{\log H} \int _\theta ^{x-\frac{\log m}{\log H}}\varphi '(u)du +g(x-\theta )\varphi (\theta )\\&= g(x-\theta )\varphi (\theta ) -2\int _\theta ^x g(x-u)\log u\,du \end{aligned}$$

while

$$\begin{aligned} S_2 = \sum _{H^{x-\theta <m\leqslant H^x}}\frac{u_m}{\log H} \int _{\frac{\log m}{\log H}}^x du = \int _{x-\theta }^x (g(u)-g(x-\theta ))du \end{aligned}$$

and this amounts to

$$\begin{aligned} S_1+S_2 = g(x-\theta )(\varphi (\theta )-\theta ) -2\int _\theta ^x g(x-u)\log u\, du +\int _{x-\theta }^x g(u)du. \end{aligned}$$

In the first integral, we bound above \(g(x-u)\) by \(2(x-u)\) by \((H_2)\). We split the second integral at \(u=\theta \); between \(x-\theta \) and \(\theta \), we bound above g(u) again by 2u while in the later range, we bound above g(u) by \(2\theta +\varepsilon _1\) by \((H-3)\) (valid since \(u\geqslant \theta \geqslant 1/2\)). We infer in this manner that

$$\begin{aligned}{} & {} S_1+S_2 \leqslant g(x-\theta )(\varphi (\theta )-\theta )\\{} & {} \quad -4\int _\theta ^x(x-u)\log u\, du +2\int _{x-\theta }^\theta udu +\int _\theta ^x (2\theta +\varepsilon _1)du. \end{aligned}$$

By Lemma 25 and noticing that \(\varphi (\theta )-\theta =-\theta (1+2\log \theta )\), we get (again bounding above \(g(x-u)\) by \(2(x-u)\) by \((H_2)\))

$$\begin{aligned} S_1+S_2&\leqslant x\varphi (x) + \bigl (g(x-\theta )+\theta -2x\bigr ) (\varphi (\theta )-\theta ) +\varepsilon _1\\&\leqslant x\varphi (x) + \theta ^2 (1+2\log \theta ) +\varepsilon _1. \end{aligned}$$

By \((H_1)\) and the above, we infer that

$$\begin{aligned} (x+a)G(x)\leqslant x\varphi (x) + \theta ^2 (1+2\log \theta ) +\varepsilon _1+\varepsilon _2. \end{aligned}$$

We also find that, when \(\theta \leqslant 1/\sqrt{e}\), we have

$$\begin{aligned} 0-\theta ^2 (1+2\log \theta ) =\int _\theta ^{1/\sqrt{e}}2u(2+\log u)du \geqslant 2\theta (1/\sqrt{e}-\theta )(2+\log \theta ). \end{aligned}$$

Hence, we get

$$\begin{aligned} (x+a)G(x)\leqslant (x+a)\varphi (x) -a\varphi (x) - 2\theta (1/\sqrt{e}-\theta )(2+\log \theta ) +\varepsilon _1+\varepsilon _2. \end{aligned}$$

We can now use \(\varphi (x)\geqslant \varphi (\theta )=-\theta \log \theta \), getting

$$\begin{aligned} (x+a)G(x)\leqslant (x+a)\varphi (x) +2a\theta \log \theta - 2\theta (1/\sqrt{e}-\theta )(2+\log \theta ) +\varepsilon _1+\varepsilon _2. \end{aligned}$$

When \(2a\theta \log \theta - 2\theta (1/\sqrt{e}-\theta )(2+\log \theta ) +\varepsilon _1+\varepsilon _2<0\), we would have \(G(x)<\varphi (x)\). However the function G is continuous and \(G(1)=\varphi (1)\), there exists an \(x_0\) between \(\theta \) and 1 for which \(G(x_0)=\varphi (x_0)\) and \(G(x)\leqslant \varphi (x)\) for x between \(\theta \) and \(x_0\). The above inequality then leads to a contradiction. Hence we have

$$\begin{aligned} 2a\theta \log \theta - 2\theta (1/\sqrt{e}-\theta )(2+\log \theta ) +\varepsilon _1+\varepsilon _2\geqslant 0. \end{aligned}$$

\(\square \)

7 Proof of Theorems 1 and 2

We use Lemma 26 with \(G(x)=F(x)\) and \(u_m=(1+\chi (m))\Lambda (m)/m\).

7.1 Initial upper bound

Lemma 16 gives us

$$\begin{aligned} L(1,\chi )\leqslant F(1)\log H+ \frac{V}{H}. \end{aligned}$$

7.1.1 Hypotheses \((H_0)\), \((H_1)\), \((H_2)\) and \((H_3)\)

Hypothesis \((H_0)\) is granted by the bound \(|f(u)|\leqslant 1\). By Lemma 20 we can then set

$$\begin{aligned} a\leqslant \frac{\gamma -1}{\log H},\quad \varepsilon _2\leqslant \frac{1.411}{\log ^2 H}, \end{aligned}$$

and this gives us Hypothesis \((H_1)\).

Lemma 10 is enough to grant Hypothesis \((H_2)\). Finally, by Lemma 24 and provided that \(H\geqslant \max (V,10^6)\), Hypothesis \((H_3)\) is satisfied with

$$\begin{aligned} \varepsilon _1\leqslant f(1)-\frac{f(1)}{\log H} +\frac{-1.15+3.81A_2^{2/3}(V/H)^{1/3}-VH^{-1}+R_\chi (H,V,q)}{\log H}. \end{aligned}$$

We will further majorize f(1) by V/2 when \(\chi \) is even and by V/H when \(\chi \) is odd.

7.1.2 Using Lemma 26

So we infer that

$$\begin{aligned} L(1,\chi )\leqslant 2(1-\theta )\log H +\frac{V}{H} \end{aligned}$$
(21)

where \(\theta \in [1/2,1/\sqrt{e}]\) satisfies

$$\begin{aligned} 2a\theta \log \theta - 2\theta (1/\sqrt{e}-\theta )(2+\log \theta ) +\varepsilon _1+\varepsilon _2\geqslant 0. \end{aligned}$$

Since \(a<0\), if this inequality is satisfied for some \(H_0>1\) then it remains true for \(H\geqslant H_0\). We select \(H=BV\), for some parameter B, and bound |f(1)| by V/H. Therefore, if \(q\geqslant q_{0}\), for some \(q_{0}>1\) which we shall specify later, we have that

$$\begin{aligned} D \geqslant \left( \frac{A_{2}B}{2.04 } \right) ^{2/3}=D_0. \end{aligned}$$

So, here are possible choices:

$$\begin{aligned} B&\geqslant \sqrt{2}/2.04 \rightarrow A_2=\sqrt{2},\\ B&\geqslant 39.6 \rightarrow A_2=0.956,\\ B&\geqslant 79.5\rightarrow A_2=0.94. \end{aligned}$$

7.1.3 Setting the numerics

We can now prove Theorems 1 and 2. We use the expression for V given in Lemma 13. We take \(H=BV\) which we assume to be \(\geqslant 10^6\), we also assume that \(q\geqslant q_0\) so that \(V\geqslant V_0\). Given a choice of B, we select

$$\begin{aligned} a&=\frac{\gamma -1}{\log ( BV_0)},\\ \varepsilon _2&=\frac{1.411}{\log (BV_0)^2},\\ \varepsilon _1&=\frac{\delta (\chi )}{B}-\frac{\delta (\chi )}{B\log (BV_0)} +\frac{-1.15+3.81A_2^{2/3}B^{-1/3}-B^{-1}+R_{\chi }(BV_0,V_0,q_0)}{\log (BV_0)}. \end{aligned}$$

where \(\delta (\chi )=(3-\chi (-1))/4\). We then compute the smallest solution \(\theta ^*\) to (21) and infer that

$$\begin{aligned} \frac{L(1,\chi )}{\log q}\leqslant 2(1-\theta ^*)\frac{\log B+\log V_0}{\log q_0} +\frac{1}{B\log q_0}. \end{aligned}$$

Result for \(\chi \) even and primitive: We select \(B=51\), and infer that \(L(1,\chi )<\frac{1}{2}\log q\) when \(q\geqslant 7\cdot 10^{22}\). But this is already known for all q’s by [32]. Even more is true if we combine the theorem of Saad Eddin in [36] together with [33, Corollary 1].

We select \(B=80\), and infer that \(L(1,\chi )<\frac{9}{20}\log q\) when \(q\geqslant 2\cdot 10^{49}\).

Result for \(\chi \) odd and primitive: We select \(B=90\), and infer that \(L(1,\chi )<\frac{1}{2}\log q\) when \(q\geqslant 2\cdot 10^{23}\).

We select \(B=145\), and infer that \(L(1,\chi )<\frac{9}{20}\log q\) when \(q\geqslant 5\cdot 10^{50}\).