How to find the sum of $k$th powers of all proper divisors of first $n$ numbers I am trying this problem but unable to come up with efficient algorithm can someone help with this problem.
I have solved the easier version of the problem 
below is the problem link.
Thanks in advance
Spoj 14175. Power Factor Sum Sum (hard)

Simply count the number of times $m$ appears in the list of all the divisors of $\{1,2,...,n\}$, it is $[\frac{n}{m}]$, (where, $[a]$ is the floor of $a$). So the sum of $k$-th power of proper divisors is $\sum\limits_{m=2}^n m^k([\frac{n}{m}]-1)$. 
