General form for sum of powers

Solution 1:

Yes. It's called Faulhaber's formula.

Essentially,

$$f(h,p)=\frac{h^{p+1}}{p+1}+\tfrac12h^p+\sum_{k=2}^p\frac{B_k}{k!}h^{p-k+1}\prod_{i=0}^{k-2}(p-i)$$

Where $B_k$ are the Bernoulli numbers. It looks complicated, but it essentially writes $f$ as a polynomial in $h$.

Solution 2:

The generalization is called Faulhaber's formula and can be derived one from the previous by a nice telescopic trick.

For example for $\sum k^2$ note that

$$(k+1)^3-k^3=3k^2+3k+1 \implies n^3-1=3\sum_{k=1}^{n} k^2+3 \sum_{k=1}^{n} k +n $$

from which $\sum_{k=1}^{n} k^2$ can be derived.

The latter argument prove that $\sum_{k=1}^{n} k^m$ is expressed by a polynomial of degree $m+1$.

Solution 3:

This is Faulhaber's formula : $$f(h,p)=\sum_{n=1}^h{n^p}=\frac1{p+1}\sum_{j=0}^p\binom{p+1}j B_j\, n^{p+1-j},$$ where $B_j$ is the $j$-th Bernoulli number, with the convention that $B_1=\frac12$, not $-\frac12$.

The generating series for the Bernoulli numbers is the expansion of $$\frac x{\mathrm e^x-1}=\sum_{j=0}^\infty B_j\frac{x^j}{j!}.$$