Divisor-square summatory bound (source code)

= Divisor-square summatory bound
{title2=$\sum_{n\le X}d(n)^2\ll X\log^3(2X)$}

For $X\geq1$, the <divisor function> obeys
$$
\sum_{n\leq X}\tau(n)^2\ll X\log^3(2X).
$$
One proof compares it with the <generalized divisor function> $d_4(n)$, the number of <ordered factorizations> $n=abcd$ into four <positive integers>. At a <prime power> $p^a$, the two counts are $(a+1)^2$ and $\binom{a+3}{3}$. The inequality $(a+1)^2\leq\binom{a+3}{3}$ holds for every <nonnegative integer> $a$, and <multiplicativity> gives $\tau(n)^2\leq d_4(n)$. Hence, with $H_m$ the <harmonic number>,
$$
\sum_{n\leq X}\tau(n)^2\leq\sum_{abcd\leq X}1\leq X\sum_{a,b,c\leq X}\frac1{abc}=XH_{\lfloor X\rfloor}^3\ll X\log^3(2X).
$$
Applying <partial summation> to this <upper bound> also yields
$$
\sum_{n\leq X}\frac{\tau(n)^2}{n}\ll\log^4(2X).
$$