= Integer power sum
{title2=$S_p(N)=\sum_{k=0}^{N-1}k^p$}
An integer power sum adds a fixed nonnegative <integer> power of consecutive <integers>. Let $N$ be a <nonnegative integer> and $p$ a <nonnegative integer>. For $p=0$, use the constant <polynomial> $x^0=1$, including at zero, so $S_0(N)=N$. Summing the <Bernoulli polynomial> <finite difference> identity makes the intermediate terms cancel and gives
$$
S_p(N)=\sum_{k=0}^{N-1}k^p
=\frac{B_{p+1}(N)-B_{p+1}(0)}{p+1}
=\frac{1}{p+1}\sum_{j=0}^{p}\binom{p+1}{j}B_jN^{p+1-j}.
$$
The sum is empty when $N=0$. For the endpoints $1,\ldots,N$, the formula valid also at $p=0$ is instead
$$
\sum_{k=1}^{N}k^p=\frac{B_{p+1}(N+1)-B_{p+1}(1)}{p+1}.
$$
For $p\geq1$, $B_{p+1}(1)=B_{p+1}(0)$, and this becomes the standard positive-endpoint formula. The exception at $p=0$ is essential: $B_1(1)-B_1(0)=1$.<NIST Digital Library of Mathematical Functions>[Karl Dilcher, Chapter 24, equations 24.4.1 and 24.4.7; the displayed equation 24.4.7 needs the endpoint adjustment at exponent zero]{ref}
For $p\geq1$, adding $N^p$ to $S_p(N)$ changes the $B_1$ contribution from $-N^p/2$ to $+N^p/2$. Equivalently,
$$
\sum_{k=1}^{N}k^p=\frac{1}{p+1}\sum_{j=0}^{p}\binom{p+1}{j}B_j^{+}N^{p+1-j}\quad(p\geq1),
$$
where only $B_1^{+}$ differs from our <Bernoulli numbers>. A quick endpoint check is $p=1$: the sums over $0,\ldots,N-1$ and $1,\ldots,N$ are $N(N-1)/2$ and $N(N+1)/2$, respectively. The latter is a <triangular number>.
Back to article page