An upperbound for divisor function squared on a short interval Let $d(n)$ be the divisor function defined by $d(n) = \sum_{m|n} 1$. I am in need of estimate of the following type:
$$
\sum_{Q \leq n \leq Q + H} d^2(n) \ll H (\log (Q + H))^T
$$
where $T$ can be any positive number, and the implicit constant in $\ll$ is independent of $Q$ and $H$. I would appreciate any references or explanations on how to prove this. Thanks you very much! 
 A: The estimate you want to prove is false. Let $Q\geq 2$ be a large integer, and let $H:=1$. Then your estimate would imply that
$$ d^2(Q)\ll(\log Q)^T, $$
hence also
$$ \log d(Q)\ll_T\log\log Q. $$
On the other hand, it is known that $\log d(Q)$ can be as large as a constant times $\log Q/\log\log Q$ (take $Q$ to be the product of the first few primes).
A: Let $d_5(n)$ be the number of solutions of the equation $x_1x_2x_3x_4x_5=n$ in positive integers. Observe that $d_5(p^\alpha)=\frac{(\alpha+1)(\alpha+2)(\alpha+3)(\alpha+4)}{24}$ for any prime $p$ and any $\alpha \geq 0$. For $\alpha=1$ we have $d_5(p^\alpha)=5>d(p^\alpha)^2=4$ and for $\alpha>1$ the inequalities $(\alpha+1)(\alpha+2)>(\alpha+1)^2$ and $(\alpha+3)(\alpha+4)\geq 30$ are satisfied. Thus, for any $\alpha>1$ and any prime $p$ the inequality
$$d_5(p^\alpha)=\frac{1}{24}(\alpha+1)(\alpha+2)(\alpha+3)(\alpha+4)\geq \frac{30}{24}(\alpha+1)^2>(\alpha+1)^2=d(p^\alpha)^2$$
holds. For $\alpha=1$ we have trivially $d_5(1)=d(1)^2=1$. Functions $d_5(n)$ and $d(n)^2$ are multiplicative, so for any $n \in \mathbb N$ we have $d_5(n) \geq d(n)^2$.
By this paper (see Lemma 2) by J. Galambos, K.-H. Indlekofer and I. Kátai we have for any $\varepsilon>0$ and arbitrary $H$ and $Q$ with $Q^\varepsilon\leq H\leq Q$
$$\sum\limits_{Q\leq n\leq Q+H} d_5(n) \leq c(5,\varepsilon)H(\log Q)^4$$
for some positive constant $c(5,\varepsilon)$ dependent on $\varepsilon$. Consequently, if $Q\geq H\geq Q^\varepsilon$ then the estimate
$$\sum\limits_{Q\leq n\leq Q+H} d(n)^2 \leq \sum\limits_{Q\leq n\leq Q+H} d_5(n) \ll_\varepsilon H(\log Q)^4$$
holds. The remaining case $H \geq Q$ is easily covered by the bound
$$\sum\limits_{1\leq n\leq X} d(n)^2 \ll X(\log X)^3,$$
which is classical.
Also, by the comment of GH, the restriction $\varepsilon=\frac{\log H}{\log Q}\gg 1$ cannot be replaced by anything like $\varepsilon\gg f(Q)$ with $f(Q)=o(\frac{1}{\log\log Q})$.
P.S. I believe that $T=4$ from my answer could be improved to $T=3$, but I cannot find a corresponding reference:(
EDIT: There it is! Theorem 1, p.27, gives us the bound with $T=3$. (Once again: thanks, Lucia)
A: Chapter 2 of Additive Theory of Prime Numbers by L.K. Hua should give a reference.
A: Not an answer, but an idea to play with and explore.
Your sum can be viewed as the square of the norm of a vector with $H+1$ components, each component of the form $d(Q+i)$.  Just to play a little, let us build this vector up in stages. To simplify things, we ignore when $Q+i$ is square, note that divisors come in pairs, and so approximate a quarter of the sum by just looking at small divisors less than some parameter $p$.  We also assume $H$ and $Q$ are sufficiently large to make the exploring fun.
So when $p$ is 1, what is the contribution? Every component is 1, so the sum of squares is  $H+1$. For $p=2$, we are now counting which numbers have 2 as a divisor as well as 1, and about half of them do, so the components alternate between 1 and 2, so the sum now is about $(1^2+2^2)/2=5/2$ times $H+1$. I now drop the $H+1$ and focus on the average square value. For $p=3$, I get a repeating pattern of length 6 involving 1's, 2's, and a 3, and I get $23/6$ as an average square value. For $p=4$, I get a pattern of length 12 and an average value of $(23+23+5+5+7)/12=63/12$. For $p=5$, a pattern of length $60$ and an average value of $(5*63 + 2*25 +12)/60=377/60$, where I take advantage of the pattern and can add twice the $L^1$ norm and the length of the previous pattern to a copy of it. For $p=6$, I keep the same length but bump up every 6th coefficient by 1, which means adding 10 plus twice the $L^1$ norm of this subsequence to get $461/60$.
Of course this is likely unoriginal, and one gets some error by noting the length $H+1$ is rarely a multiple of each of the first  $p$ numbers, but one can get a feel for the progression and note that in $\sqrt{Q}$ steps, each step adds what seems to be a value less than 2 to the average.  As $p$ exceeds $H$, most of the time the contribution to the average is zero.  How much is most? This is where you can try this idea out.
Gerhard "Mathematics Can Be A Toy" Paseman, 2017.05.16.
