The function I am trying to integrate is
$\left(x - \lfloor x\rfloor\right)^2$
I am trying to integrate this from $0$ to $1000$.
I have figured out a few things. First,
$$ \int_0^N \lfloor x \rfloor^k\ dx = \sum_{n=1}^{N - 1} n^k \text{,}$$ where $k$ is a fixed positive integer.
Thus,
$$ \int_0^N \left( x^2 -2 \lfloor x \rfloor + \lfloor x \rfloor^2\right)\ dx = \frac{1}{3}N^3 - 2 \sum_{i=1}^{N-1} n + \sum_{i=1}^{N-1} n^2 $$
At this point I should be able to plug and chug and get the correct answer, but my answer was way off. Wolfram gives the correct answer as $\frac{1000}{3}$. My answer was negative, and many orders of magnitude off.
What am I doing wrong? Did I get any details wrong?