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! 



An upperbound for divisor function squared on a short interval
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](https://www.jstor.org/stable/2000368?seq=1#page_scan_tab_contents) (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!](http://eprints.nottingham.ac.uk/28304/1/281269.pdf) Theorem 1, p.27, gives us the bound with $T=3$. (Once again: thanks, Lucia)


