We start with proving the explicit upper bound in Theorem 2, as the claims required for the proof of Theorem 1 can be easily adapted by the lemmae from this section.
Let us consider the polynomial \(f(n)=n^2+2bn+c\) with integer coefficients b and c, and the function \(\rho (d)\) defined in (1.2) counts the roots of f(n) in a full residue system modulo d. Let \(\delta =b^2-c\) and \(\chi (n)=\left( \frac{4\delta }{n}\right) \) for the Kronecker symbol \(\left( \frac{.}{.}\right) \).
The core of the proofs of both Theorems 1 and 2 is the following convolution lemma which we proved in [11].
Lemma 1
([11], Lemma 2.1) Let \(\delta =b^2-c\) be square-free and \(\delta \not \equiv 1\pmod 4\). Then we have the identity
$$\begin{aligned} \rho (d)=\sum _{lm=d}\mu ^2(l)\chi (m). \end{aligned}$$
The proof of Lemma 1 is based on elementary facts about the function \(\rho (d)\) at prime powers and manipulations of the Dirichlet series it generates.
Further we need the following explicit estimates.
Lemma 2
For any integer \(N\ge 1\) we have
$$\begin{aligned} \sum _{n\le N}\mu ^2(n)=\frac{N}{\zeta (2)}+E_1(N), \end{aligned}$$
where \(|E_1(N)|\le 2\sqrt{N} +2\).
Proof
Let us denote \(Q(N):=\sum _{n\le N}\mu ^2(n)\) for \(N\ge 1\). Then we can write
$$\begin{aligned} Q(N)=\sum _{n\le N}\sum _{d^2\mid n}\mu (d)=\sum _{1\le d\le \sqrt{N}}\mu (d)\sum _{\begin{array}{c} 1\le n\le N\\ d^2\mid n \end{array}}1=\sum _{1\le d\le \sqrt{N}}\mu (d)\left[ \frac{N}{d^2}\right] \end{aligned}$$
Using \(\sum _{n=1}^\infty \mu (d)/d^2=1/\zeta (2)\) we see that
$$\begin{aligned} E_1(N)=Q(N)-\frac{N}{\zeta (2)}=-\sum _{1\le d\le \sqrt{N}}\mu (d)\left\{ \frac{N}{d^2}\right\} - N\sum _{d>\sqrt{N}}\frac{\mu (d)}{d^2}, \end{aligned}$$
hence
$$\begin{aligned} |E_1(N)|\le \sqrt{N} +N\left| \sum _{d>\sqrt{N}}\frac{\mu (d)}{d^2}\right| . \end{aligned}$$
(2.1)
On its turn for every real \(x>1\)
$$\begin{aligned} \left| \sum _{d>x}\frac{\mu (d)}{d^2}\right| \le \sum _{d>x}\frac{1}{d^2}<\int _{x-1}^\infty \frac{dt}{t^2}=\frac{1}{x-1} \end{aligned}$$
and \(N/(\sqrt{N}-1)\le \sqrt{N}+2\) for \(N\ge 4\). Now from (2.1) it follows that \(Q(N)=N/\zeta (2)+E_1(N)\) and \(|E_1(N)|\le 2(\sqrt{N}+1)\) for \(N\ge 4\). It is trivial to check that the inequality
$$\begin{aligned} \left| Q(N)-\frac{N}{\zeta (2)}\right| \le 2\sqrt{N}+2 \end{aligned}$$
holds also for \(N\in \left\{ 1,2,3\right\} \) and this proves the statement of the lemma. \(\square \)
The following effective Pólya–Vinogradov inequality is due to Pomerance.
Lemma 3
([16], Theorem 1) Let
$$\begin{aligned} M_\chi :=\max _{L,P}\left| \sum _{n=L}^P \chi (n)\right| \end{aligned}$$
for a primitive character \(\chi \) to the modulus \(q>1\). Then
$$\begin{aligned} M_\chi \le \left\{ \begin{array}{ll} \frac{2}{\pi ^2}q^{1/2}\log {q}+\frac{4}{\pi ^2}q^{1/2}\log \log {q} +\frac{3}{2} q^{1/2}\,, &{} \chi \text { even;}\\ \frac{1}{2\pi }q^{1/2}\log {q}+\frac{1}{\pi }q^{1/2}\log \log {q}+ q^{1/2},&{}\chi \text { odd. } \end{array}\right. \end{aligned}$$
The next lemma is critical for obtaining the right main term in the explicit upper bound of Theorem 2.
Lemma 4
For any integer \(N\ge 1\) we have
$$\begin{aligned} \displaystyle \sum _{n\le N}\frac{\chi (n)}{n}=L(1,\chi )+E_2(N), \end{aligned}$$
where \(\left| E_2(N)\right| \le 2M_\delta /N\) and \(M_\delta \) is the constant defined in Theorem 2.
Proof
This statement, especially the estimate of the error term, is much less trivial and follows from the effective Pólya–Vinogradov inequality of Pomerance. First we notice that
$$\begin{aligned} \sum _{n\le N}\frac{\chi (n)}{n}=\sum _{n=1}^\infty \frac{\chi (n)}{n}-\sum _{n>N}\frac{\chi (n)}{n}=L(1,\chi )+E_2(N). \end{aligned}$$
Let us denote \(X(N):=\sum _{1\le n\le N}\chi (n)\) for any positive integer N. Then by Abel’s summation it follows that for any positive integer \(Z>N\) we have
$$\begin{aligned} \left| \sum _{N<n\le Z}\frac{\chi (n)}{n}\right|&=\left| \frac{X(Z)}{Z}-\frac{X(N)}{N}+\int _N^Z\frac{X(t)}{t^2}dt\right| \\&\le \frac{\left| X(Z)\right| }{Z}+\frac{\left| X(N)\right| }{N}+\int _N^Z\frac{\left| X(t)\right| }{t^2}dt . \end{aligned}$$
Recall the definition of the quantity \(M_\chi \) in Lemma 3. Then
$$\begin{aligned} \left| \sum _{N<n\le Z}\frac{\chi (n)}{n}\right| \le M_\chi \left( \frac{1}{Z}+\frac{1}{N}+\int _N^Z\frac{dt}{t^2}\right) =\frac{2M_\chi }{N}, \end{aligned}$$
which is uniform in Z. Therefore \(|E_2(N)|=\left| \sum _{n>N}\chi (n)/n\right| \le 2M_\chi /N\). Now by the conditions on \(\delta \) to be square-free and not congruent to 1 modulo 4 it follows that the discriminant \(4\delta \) is fundamental, thus the character \(\chi (n)=\left( \frac{4\delta }{n}\right) \) is primitive with a conductor \(4|\delta |\). Then according to Lemma 3 \(M_\chi \le M_\delta \) and this proves the statement. \(\square \)
The following lemma is due to Ramaré. One could easily extract the right main term from Lemma 2 through Abel summation but the estimate of the minor term requires computer calculations.
Lemma 5
([17], Lemma 3.4) Let \(x\ge 1\) be a real number. We have
$$\begin{aligned} \sum _{n\le x}\frac{\mu ^2(n)}{n}\le \frac{\log x}{\zeta (2)}+1.166. \end{aligned}$$
Let us start with the proof of Theorem 2. Note that from the condition \(f(N)\ge f(1)\) and the convexity of the function f(x) we have \(f(N)=\max _{1\le n\le N}f(n)\). Using the Dirichlet hyperbola method we have
$$\begin{aligned} \sum _{1\le n\le N}\tau (f(n))&=\sum _{1\le n\le N}\sum _{d\mid f(n)}1\le 2\sum _{1\le n\le N}\sum _{\begin{array}{c} d\le \sqrt{f(n)}\\ d\mid f(n) \end{array}}1\\&=2\sum _{1\le d\le \sqrt{f(N)}}\sum _{\begin{array}{c} 1\le n\le N\\ d+\mathcal {O}(1)\le n \end{array}}\sum _{d\mid f(n)}1\le 2\sum _{1\le d\le \sqrt{f(N)}}\sum _{\begin{array}{c} 1\le n\le N\\ d\mid f(n) \end{array}}1. \end{aligned}$$
Recall the definition (1.2) of the function \(\rho (d)\). Then the innermost sum equals \(\left[ N/d\right] \) copies of \(\rho (d)\) plus a remaining part smaller than \(\rho (d)\). Recall that \(X=\sqrt{f(N)}\). Then
$$\begin{aligned} \sum _{1\le n\le N}\tau (f(n))\le 2\sum _{1\le d\le X}\left( \frac{N}{d} \rho (d)+\rho (d)\right) =2N\sum _{1\le d\le X}\frac{\rho (d)}{d} +2\sum _{1\le d\le X}\rho (d). \end{aligned}$$
(2.2)
From the convolution identity stated in Lemma 1 it immediately follows that
$$\begin{aligned} \sum _{d\le X}\rho (d)=\sum _{lm\le X}\mu ^2(l)\chi (m)=\sum _{l\le X}\mu ^2(l)\sum _{m\le X/l}\chi (m). \end{aligned}$$
Recall the definition of \(M_\chi \) and the Pomerance bounds \(M_\chi \le M_\delta \). Then using also Lemma 2 we get
$$\begin{aligned} \sum _{d\le X}\rho (d)\le M_\delta \sum _{l\le X}\mu ^2(l)\le M_\delta \left( \frac{X}{\zeta (2)}+2\sqrt{X}+2\right) . \end{aligned}$$
(2.3)
Similarly by the convolution property of the function \(\rho (d)\) and Lemma 4 we can write
$$\begin{aligned} \sum _{d\le X}\frac{\rho (d)}{d}=\sum _{l\le X}\frac{\mu ^2(l)}{l}\sum _{m\le X/l}\frac{\chi (m)}{m}\le \sum _{l\le X}\frac{\mu ^2(l)}{l}\left( L(1,\chi )+2M_\delta \frac{l}{X}\right) . \end{aligned}$$
(2.4)
One could go further using Lemma 5 and again Lemma 2. We obtain
$$\begin{aligned} \sum _{d\le X}\frac{\rho (d)}{d}&\le L(1,\chi )\sum _{l\le X}\frac{\mu ^2(l)}{l}+\frac{2M_\delta }{X}\sum _{l\le X}\mu ^2(l)\nonumber \\&\le L(1,\chi )\left( \frac{\log X}{\zeta (2)}+1.166\right) +\frac{2M_\delta }{X}\left( \frac{X}{\zeta (2)}+2\sqrt{X}+2\right) . \end{aligned}$$
(2.5)
Plugging the estimates (2.3) and (2.5) in (2.2) gives the statement of Theorem 2.
Let us prove Corollary 3. For the polynomial \(f(n)=n^2+1\) we can be more precise as the condition \(d\le \sqrt{f(n)}\) is equivalent to \(d\le n\). Then after applying more carefully the hyperbola method and changing the order of summation we obtain
$$\begin{aligned} \sum _{n\le N}\tau (n^2+1)&=2\sum _{n\le N} \sum _{\begin{array}{c} d\le n\\ d\mid n^2+1 \end{array}}1=2\sum _{1\le d\le N}\sum _{\begin{array}{c} d\le n\le N\\ d\mid n^2+1 \end{array}}1\\&=2\sum _{1\le d\le N}\left( \sum _{\begin{array}{c} 1\le n\le N\\ d\mid n^2+1 \end{array}}1-\sum _{\begin{array}{c} 1\le n< d\\ d\mid n^2+1 \end{array}}1\right) \le 2N\sum _{1\le d\le N}\frac{\rho (d)}{d}. \end{aligned}$$
Similarly to (2.4) we have
$$\begin{aligned} \sum _{1\le d\le N}\frac{\rho (d)}{d}=\sum _{l\le N}\frac{\mu ^2(l)}{l}\sum _{m\le N/l}\frac{\chi (m)}{m}\le \sum _{l\le N}\frac{\mu ^2(l)}{l}\left( L(1,\chi )+2M_\chi \frac{l}{N}\right) . \end{aligned}$$
In this case \(M_\chi \le 1\) and \(L(1,\chi )=\pi /4\), and application of Lemmas 5 and 2 gives
$$\begin{aligned} \sum _{1\le d\le N}\frac{\rho (d)}{d}&\le \frac{\pi }{4}\sum _{l\le N}\frac{\mu ^2(l)}{l}+\frac{2}{N}\sum _{l\le N}\mu ^2(l)\\&\le \frac{\pi }{4}\left( \frac{\log N}{\zeta (2)}+1.166\right) +\frac{2}{N}\left( \frac{N}{\zeta (2)}+2\sqrt{N}+2\right) . \end{aligned}$$
After numerical approximation of the constants we conclude the validity of Corollary 3.