# Proof for Sum of Sigma Function

How to prove:

$$\sum_{k=1}^n\sigma(k) = n^2 - \sum_{k=1}^nn\mod k$$

where $\sigma(k)$ is sum of divisors of k.

-

$$\sum_{k=1}^n \sigma(k) = \sum_{k=1}^n\sum_{d|k} d = \sum_{d=1}^n\sum_{k=1}_{d|k}^{n}d = \sum_{d=1}^n d\left\lfloor \frac n d\right\rfloor$$
Now just prove that $$d\left\lfloor \frac n d\right\rfloor = n-(n\mod d)$$