I have been working on modular arithmetic, I have tried to find the summation $\sum_{i=1}^N N\pmod {i^2}$ without actual calculation i.e. a shorthand notation or value of this summation for any such $N$.
I have tried to reduce it to $O(\sqrt N)$
How to solve these problems? How to calculate this value faster in $O(1)$ or $O(\log(N))$?
Is there any sequence?
$S(N) = \sum_{i=1}^N N\pmod {i^2}$