projecteuler.net

Sum of Squares

 Published on Sunday, 31st January 2021, 04:00 am; Solved by 587;
Difficulty rating: 10%

Problem 745

For a positive integer, $n$, define $g(n)$ to be the maximum perfect square that divides $n$.
For example, $g(18) = 9$, $g(19) = 1$.

Also define $$\displaystyle S(N) = \sum_{n=1}^N g(n)$$

For example, $S(10) = 24$ and $S(100) = 767$.

Find $S(10^{14})$. Give your answer modulo $1\,000\,000\,007$.