How to find the sum of the remainders of a number modulo all the perfect powers less than it?

111 Views Asked by At

Perfect powers are numbers of the form $ x^y $ where $x\geq1$ and $y>1$. For example, perfect powers are $\{1, 4, 8, 9, 16, 25, 27, 32, \cdots \}$. If $n$ is a natural number, then we denote by $P(n)$ the set of perfect powers $\le n$.

We further denote by $n\bmod x$ the remainder of division of a natural number $n$ by another natural number $x>0$. This will be an integer in the range $[0,x-1]$.

Let's fix a natural number $n$. Can we say anything about the sum? $$S(n):=\sum_{p\in P(n)} (n\bmod p)$$

In other words, the sum has one term for each perfect power $p\le n$.

I guess there are some correlations between $ n\bmod2 $, $ n\bmod 2^2 $, $ n\bmod 2^3 $ etc, but couldn't figure out a way to do it without traversing the entire list of numbers.