Faulhaber's Formula

Author

Eric W. Weisstein
August 30, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Algebra/FaulhabersFormula.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/FaulhabersFormula.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Formula

(∑_(k=1)^n)(k^p)==(1/(p+1))(∑_(i=1)^(p+1))(n^i) (BernoulliB[-i+p+1]) (Binomial[p+1, i]) (((-1))^(KroneckerDeltaSeq[i,p]))==(HarmonicNumber2[n, -p])

Faulhaber[p_,n_]:=Sum[(-1)^KroneckerDelta[i,p]Binomial[p+1,i]BernoulliB[p+1-i]n^i,{i,p+1}]/(p+1)

Faulhaber[p,n]

Sum[(k^p),{k,1,n}]

Subtract@@@Table[Block[{n=RandomInteger[{1,10}],p=RandomInteger[{0,10}]},{Sum[(-1)^KroneckerDelta[i,p]Binomial[p+1,i]BernoulliB[p+1-i]n^i,{i,p+1}]/(p+1),HarmonicNumber[n,-p]}],{100}]//Union

Table[Faulhaber[p,n]-HarmonicNumber[n,-p],{p,5},{n,5}]

Values

In terms of n

Table[FactorTerms[Faulhaber[p,n]],{p,13}]//Column//TraditionalForm

In terms of N==(1/2) ((n^2)+n)

Solve[N==(1/2) ((n^2)+n),n]

Table[FactorTerms[Expand[Faulhaber[p,n]/.n->(1/2) (-1+(Sqrt[1+8 N]))]],{p,1,17,2}]//Column//TraditionalForm

r-Fold Summation

Knuth (1993)

RSum[0,p_,n_]:=n^p
RSum[r_,p_,n_]:=Sum[RSum[r-1,p,k],{k,n}]

Nr[r_,n_]:=(n^2+r n)/2

RSum[2,4,n]

Subtract@@{RSum[2,4,n],(4Nr[2,n]-1)RSum[2,2,n]/5}//Expand

RSum[3,4,n]

Subtract@@{RSum[3,4,n],(4Nr[3,n]-1)RSum[3,2,n]/7}//Expand

RSum[4,4,n]

Subtract@@{RSum[4,4,n],(6Nr[4,n]-1)RSum[4,2,n]/14}//Expand