Let $d(n)$ be the number of divisors of an integer $n$.  

Does there exists a bound for $\sum\_{k\leq n}d^2(k)$?  

I saw in a paper of Barry and Louboutin that the asymptotics is $\frac1{\pi^2}nlog^3n$ but there was no proof nor a reference or any indication that this is the best possible bound.  

Any idea where can I find this?  

Thanks.



Second moment for the number of divisors function
This can be proved by [Perron's formula](http://en.wikipedia.org/wiki/Perron%27s_formula), making use of the properties of the associated Dirichlet series
$$ g(s):=\sum\_{k=1}^\infty\frac{d^2(k)}{k^s},\quad\Re s>1. $$
We have an Euler product decomposition over the primes $p$,
$$ g(s)=\prod\_p\left(\sum\_{m=0}^\infty\frac{d^2(p^m)}{p^{ms}}\right)=\prod\_p\left(\sum\_{m=0}^\infty\frac{(m+1)^2}{p^{ms}}\right)=\prod\_p\frac{1-p^{-2s}}{(1-p^{-s})^4},\quad \Re s>1.$$
This shows that $g(s)$ has meromorphic extension to $\mathbb{C}$, namely
$$ g(s)=\frac{\zeta(s)^4}{\zeta(2s)}. $$
In particular, $(s-1)^4g(s)$ is holomorphic and bounded in any half-plane $\Re s>\sigma\_0>1/2$, and at $s=1$ it takes the value $1/\zeta(2)$. Combining Perron's formula, Cauchy's theorem, the residue theorem, and a contour shift, it is not hard to deduce that
$$ \sum\_{k=1}^nd^2(k)\sim\frac{1/\zeta(2)}{3!}n(\log n)^3=\frac{1}{\pi^2}n(\log n)^3.$$
The $3!$ and the $(\log n)^3$ come from the third term in the Taylor expansion
$$ n^{s-1}=\sum\_{r=0}^\infty \frac{(\log n)^r}{r!}(s-1)^r.$$


Of course the same method yields secondary terms with smaller powers of $\log n$. Finding a good error term next to these is a difficult task and goes under the label "Dirichlet's divisor problem". You can learn about these things in textbooks of analytic number theory (e.g. Tenenbaum or Montgomery-Vaughan). Hope this helps.


