Sum of all divisors of the first $n$ positive integers.

445 Views Asked by At

Yesterday I was going through Möbius Function notes, and found that writing $n = p_{1}^{\alpha_1}p_{2}^{\alpha_2}\cdots p_{r}^{\alpha_r}$, the sum of all divisors can be written as. $$ e(n) = \prod_{i = 1}^r \frac{p_{i}^{(\alpha_i + 1)}-1}{p_i - 1}. $$ So I decided to calculate my own sum. $$ S(n) = \sum_{i = 1}^r \frac{p_{i}^{(\alpha_i + 1)}-1}{p_i - 1}, $$ which is simple by the looks of it. To make it even more hard, I added an additional sum. $$ F(n) = \sum_{m = 1}^n S(m) $$ Is there a shortform to calculate this $F(n)$ easily for large values of n as well?

1

There are 1 best solutions below

7
On

A slightly easier to compute expression for $F(n)$ is $$F(n)=\sum_{d=1}^nd\Big\lfloor\frac{n}{d}\Big\rfloor.$$ One way to see this, is to note that if $d$ is a divisor of $S(m)$ and $m\leq n$, then $d\leq n$. And every positive integer $d\leq n$ is summed precisely once for each multiple of $d$ up to $n$, so $\lfloor\tfrac nd\rfloor$ times.