How to compute this sum?

192 Views Asked by At

I want to sum the following:

$$f(n) = \sum_{i=1}^n (i^3 \cdot (n \mod i))$$

Since the sum can be huge I have to output the sum modulo some given number m. How can I approach this problem?

Also, n can be upto $10^{10}$.

1

There are 1 best solutions below

0
On

As Duplicate question of this has been deleted, I am posting the snapshot of answer posted there.enter image description here