Is there a closed-form or an efficient way to calculate $\sum_{i=1}^{N/2} i(N \mod i) $

139 Views Asked by At

I am trying to solve problem 401 of Project Euler, without giving much away, I have broken down the problem into several summations and I am trying to calculate one part, which is:

$$ \sum_{i=1}^{N/2} i (N \mod i)$$

The N is really large $10^{15}$ and it is not computationally feasible to loop so many times. I want to avoid multi-threading because that feels like cheating, so I am looking for a way to reduce this problem into something easier.