any $A, B > 1$, and any positive integer $k \ll (AB)^{O(1)}$, one has $$\sum_{a {\leqslant}A} \sum_{b {\leqslant}B} \tau(kab^2+1) \ll A B \log(A+B) \log(1+k).$$

Using the heuristic that $\tau(n) \sim \log n$ on the average (see ), one expects the true bound here to be $O( A B \log(A+B) )$. The $\log(1+k)$ loss can be reduced (for some ranges of $A,B,k$, at least) by using more tools (such as the Polya-Vinogradov inequality), but this slightly inefficient bound will be sufficient for our applications.

We prove Proposition \[kab\] (as well as some variants of this estimate) in Section \[kab-sec\]. Our main tool is a more quantitative version of a classical bound of Erdős [@erdos] on the sum $\sum_{n {\leqslant}N} \tau(P(n))$ for various polynomials $P$, which may be of independent interest; see Theorem \[erdos-bound\].

We also collect a number of auxiliary results concerning the quantities $f_i(n)$, some of which were in previous literature. Firstly, we have a vanishing property at odd squares:

\[odd\] For any odd perfect square $n$, we have $f_{{\operatorname{I}}}(n)=f_{{\operatorname{II}}}(n) = 0$.

This observation essentially dates back to Schinzel (see [@guy], [@mordell], [@schinzel]) and Yamomoto (see [@yamamoto]) and is an easy application of quadratic reciprocity : for the convenience of 