I need to evaluate the sum $$\sum_{i=1}^n i^2\cdot\lfloor{\frac ni}\rfloor$$ After a little bit of math I found that the above sum is equal to: $$\sum_{i=1}^n i\cdot n - \sum_{i=1}^ni\cdot (n\space mod \space i)$$ The first (left) sum has a closed form, $\frac {n^2\cdot (n+1)}{2}$, but what about the left?
I need this for computational use, for very large $n$, so performing the summation with $O(n)$ is probably the wrong approach, which is why I suspect it has a closed form, or at least another way to perform the summation with smaller complexity, perhaps $O(\sqrt n)$. If the sum to the right has no closed form, then is there any other way to evaluate the original sum?
nvery good approximation is: $\frac{1}{3}-\frac{n}{3}+\frac{n^3 \psi ^{(2)}(n)}{6}+\frac{n^3 \zeta (3)}{3}$ where $\psi ^{(2)}(n)$ is 2-th derivative of the digamma function. – Mariusz Iwaniuk Apr 24 '19 at 19:591/3 - n/3 + (n^3*PolyGamma[2, n])/6 + n^3*Zeta[3]/3where digamma function see here: http://mathworld.wolfram.com/PolygammaFunction.html – Mariusz Iwaniuk Apr 25 '19 at 16:12