How to obtain an upper bound for $\sum_{d|n} d \sum_{m|d} m$? I would like to obtain an upper bound for 
$$
S(n) = \sum_{d|n} d \sum_{m|d} m. 
$$
I can prove $S(n) \ll d(n) n^2$ where $d(n)$ is the number of divisors of $n$. 
But in the paper I am reading it states without explanation 
$$
S(n) \ll n^3/\phi^2(n) 
$$
where $\phi$ is the Euler totient function. I would appreciate any explanation of this. Thank you!
 A: I can show the following
(modulo my usual mistakes):
$\sum_{m=1}^{\infty} \dfrac{S(m)}{m^k}
=\zeta(k)\zeta^2(k-1)$
and
$ \dfrac{\sigma^2(n)\phi(n)}{n}
\lt S(n)
\lt \sigma^2(n)
$.
Here's how.
As Crostul suggests,
if 
$S(n) = \sum_{d|n} d \sum_{m|d} m
$
then
$\begin{array}\\
S(p^k) 
&= \sum_{d|p^k} d \sum_{m|d} m\\
&= \sum_{j=0}^k p^j \sum_{m|p^j} m\\
&= \sum_{j=0}^k p^j \sum_{i=0}^jp^i\\
&= \sum_{j=0}^k p^j \dfrac{p^{j+1}-1}{p-1}\\
&= \dfrac1{p-1}\sum_{j=0}^k p^j(p^{j+1}-1)\\
&= \dfrac1{p-1}\left(\sum_{j=0}^k p^jp^{j+1}-\sum_{j=0}^k p^j\right)\\
&= \dfrac1{p-1}\left(p\sum_{j=0}^k p^{2j}-\dfrac{p^{k+1}-1}{p-1}\right)\\
&= \dfrac1{p-1}\left(\dfrac{p(p^{2(k+1)}-1}{p^2-1}-\dfrac{p^{k+1}-1}{p-1}\right)\\
&= \dfrac1{(p-1)^2(p+1)}\left(p(p^{2(k+1)}-1)-(p+1)(p^{k+1}-1)\right)\\
&= \dfrac1{(p-1)^2(p+1)}\left(p^{2(k+1)+1}-p-(p^{k+2}+p^{k+1}-p-1)\right)\\
&= \dfrac1{(p-1)^2(p+1)}\left(p^{2k+3}-p^{k+2}-p^{k+1}+1)\right)\\
&= \dfrac1{(p-1)^2(p+1)}\left(p^{2k+3}-p^{k+1}-p^{k+2}+1)\right)\\
&= \dfrac1{(p-1)^2(p+1)}\left(p^{k+1}(p^{k+2}-1)-(p^{k+2}-1))\right)\\
&= \dfrac1{(p-1)^2(p+1)}\left((p^{k+1}-1)(p^{k+2}-1)\right)\\
&= \dfrac1{(p+1)}\dfrac{(p^{k+1}-1)(p^{k+2}-1)}{(p-1)^2}\\
&= \dfrac1{(p+1)}\sigma(p^k)\dfrac{(p^{k+2}-1)}{p-1}\\
&= \dfrac1{(p+1)}\sigma(p^k)\dfrac{(p^{k+2}-p+p-1)}{p-1}\\
&= \dfrac1{(p+1)}\sigma(p^k)\left(\dfrac{p^{k+2}-p}{p-1}+1\right)\\
&= \dfrac1{(p+1)}\sigma(p^k)\left(p\sigma(p^k)+1\right)\\
&= \dfrac1{(p+1)}\sigma(p^k)\left((p+1)\sigma(p^k)-\sigma(p^k)+1\right)\\
&= \dfrac1{(p+1)}\sigma(p^k)(p+1)\sigma(p^k)-\dfrac1{(p+1)}\sigma(p^k)(\sigma(p^k)-1)\\
&= \sigma^2(p^k)-\dfrac{\sigma(p^k)(\sigma(p^k)-1)}{(p+1)}\\
&= \sigma^2(p^k)\left(1-\dfrac{(1-1/\sigma(p^k)}{(p+1)}\right)\\
&< \sigma^2(p^k)\\
\text{so}\\
S(n)
&\lt \sigma^2(n)\\
\text{and}\\
S(p^k)
&> \sigma^2(p^k)\left(1-\dfrac{1}{(p+1)}\right)\\
&= \sigma^2(p^k)\left(\dfrac{p}{(p+1)}\right)\\
&> \sigma^2(p^k)\left(\dfrac{p-1}{p}\right)\\
&= \sigma^2(p^k)\left(\dfrac{p-1}{p}\right)\\
&= \sigma^2(p^k)\dfrac{\phi(p^k)}{p^k}\\
\text{so}\\
S(n)
&\gt \dfrac{\sigma^2(n)\phi(n)}{n}\\
\text{also}\\
S(n) 
&= \sum_{d|n} d \sum_{m|d} m\\
&= \sum_{m|n}\sum_{d|\frac{n}{m}} d  m\\
&= \sum_{m|n}m\sum_{d|\frac{n}{m}} d\\
&= \sum_{m|n}m\sigma(\frac{n}{m})\\
\text{so if}\\
s(k)
&=\sum_{m=1}^{\infty} \dfrac{S(m)}{m^k},\\
u(k)
&=\sum_{m=1}^{\infty} \dfrac{m}{m^k}\\
&=\zeta(k-1)\\
\text{and}\\
v(k)
&=\sum_{m=1}^{\infty} \dfrac{\sigma(m)}{m^k}\\
&=\zeta(k)\zeta(k-1)\\
\text{then}\\
s(k)
&=u(k)v(k)\\
&=\zeta(k)\zeta^2(k-1)\\
\end{array}
$
