I am trying to prove or disprove the following statement:
$$\sum_{r|n} d(r^2) = d^2(n),$$
where $d$ is the number of divisors function.
Computing it for small numbers yields equality, so I at least think it's true. But I can't see how to prove it formally. I have tried working with prime factorisations, but finding equality between terms seems near-impossible at best. My best guess is there is a way to manipulate
$$\sum_{r\mid n} \sum_{k\mid r^2} 1$$
into a form which becomes the RHS, although my attempts at writing $n=ar$ and $r^2=bk$ for $a,b\in\mathbb{Z}$ become very messy when I attempt substitution.
Any assistance or hints would be greatly appreciated! Thank you!
Write $n=p_1^{\alpha_1}\cdots p_k^{\alpha_k}$. Then \begin{align}\sum_{r|n} d(r^2)&=\sum_{0\leq i_1 \leq \alpha_1,\ldots,0\leq i_k \leq \alpha_k} d((p_1^{i_1}\cdots p_k^{i_k})^2)\\&=\sum_{0\leq i_1 \leq \alpha_1,\ldots,0\leq i_k \leq \alpha_k} d(p_1^{2i_1}\cdots p_k^{2i_k})\\&=\sum_{0\leq i_1 \leq \alpha_1,\ldots,0\leq i_k \leq \alpha_k}(2i_1+1)\cdots(2i_k+1)\\&=\left(\sum_{0\leq i_1 \leq \alpha_1}(2i_1+1)\right)\cdots \left( \sum_{0\leq i_k \leq \alpha_k}(2i_k+1)\right)\\&=\left(2\frac{\alpha_1(\alpha_1+1)}{2}+(\alpha_1+1)\right)\cdots \left( 2\frac{\alpha_k(\alpha_k+1)}{2}+(\alpha_k+1)\right)\\&=(\alpha_1+1)^2\cdots(\alpha_k+1)^2\\&=d(n)^2.\end{align}