Solution (source code)

= Solution

Additivity of the <definite integral> combines the adjacent intervals into $[0,n]$. For an integer $n\geq1$, the <power rule> gives
$$
\sum_{j=0}^{n-1}\int_j^{j+1}(x-2)^n\,dx
=\int_0^n(x-2)^n\,dx
=\boxed{\frac{(n-2)^{n+1}-(-2)^{n+1}}{n+1}}.
$$
For $n=0$, interpret the indexed sum as an <empty sum>, equal to zero; the displayed expression also gives zero. This convention resolves the otherwise degenerate endpoint of the stated nonnegative-integer range.