Power Sum

Author

Eric W. Weisstein
December 3, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Calculus/PowerSum.nb.

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

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

Code

PowerSum[p_,n_]:=Sum[k^p,{k,n}]

Sums over Integers

Factored Form

Table[Sum[k^p,{k,n}],{p,10}]//TableForm

Expanded Form

FactorTerms/@%//TableForm

Denominator/@First/@FactorTerms/@Table[Sum[k^p,{k,n}],{p,20}]

(c=Rest/@(CoefficientList[#,n]&/@Rest/@FactorTerms/@Table[Sum[k^p,{k,n}],{p,20}]))//ColumnForm

Count[#,0]&/@Rest/@(CoefficientList[#,n]&/@Rest/@FactorTerms/@Table[Sum[k^p,{k,n}],{p,50}])

Max/@c

Analytic Expression

Sum[k^p,{k,n}]

Faulhaber's Formula

Kron[k_,p_]:=If[k==p,-1,1]
Faulhaber[p_]:=Simplify[1/(p+1) Sum[Kron[k,p]Binomial[p+1,k]BernoulliB[p+1-k]n^k,{k,p+1}]]

Table[Expand[Sum[k^p,{k,n}]-Faulhaber[p]],{p,20}]

Schultz's Method

Schultz[k_]:=Module[{i,j},
Table[Sum[(-1)^(i-j+1)Binomial[i,j]A[i],{i,j+1,k+1}]==KroneckerDelta[j,k],{j,0,k}]
]

SchultzSolve[k_]:=Solve[Schultz[k],Array[A,k+1]]

Schultz[1]

Solve[{A[1]-A[2]==0,2 A[2]==1},Array[A,2]]

SchultzSolve[1]

Schultz[2]

Solve[{A[1]-A[2]+A[3]==0,2 A[2]-3 A[3]==0,3 A[3]==1},Array[A,3]]

SchultzSolve[2]

SchultzSolve[3]

SchultzSolve[4]

Table[Expand[Sum[k^p,{k,n}]],{p,4}]//TableForm

Sums

(∑_(k=1)^n)(k^p)==(n^p)+(∑_(k=0)^p)((((Subscript[B, k]) p!) (n^(-k+p+1)))/(k! (-k+p+1)!))

Together/@Table[n^p+Sum[((BernoulliB[k]p!)/(k!(p-k+1)!))(n^(p-k+1)),{k,0,p}],{p,5}]

Together/@Table[Sum[(((n^k) (-1)^(1-p+k)BernoulliB[1-k+p] p!)/(k! (1-k+p)!)),{k,p+1}],{p,5}]

(∑_(k=1)^n)(k^p)=(∑_(k=1)^(p+1))(((((-1))^(k-p+1)) (Subscript[B, -k+p+1]) p! )/(k! (-k+p+1)!))(n^k)

Together/@Table[(∑_(k=1)^(p+1))(((((-1))^(k-p+1)) BernoulliB[-k+p+1] p! )/(k! (-k+p+1)!))(n^k),{p,5}]

a[p_,k_]:=(((-1)^(1-p+k)BernoulliB[1-k+p] p!)/(k! (1-k+p)!))

aa[k_,i_]:=Coefficient[Sum[l^k,{l,n}],n,i]

Sum of coefficients

Table[Sum[a[p,k],{k,p+1}],{p,10}]

Table[Sum[aa[p,k],{k,p+1}],{p,10}]

(∑_(k=0)^n)k (x^k)==(((n (x-1)-1) (x^(n+1))+x)/(((x-1))^2))

Simplify[Sum[k x^k,{k,0,n}]]

V7

Sum[k x^k,{k,0,n}]

FullSimplify[%]

(∑_i^k)(∑_(j=0)^(i-1))(((-1))^j) (Binomial[k+1, j]) (((i-j))^k) (Binomial[-i+k+n+1, n-i])==(HarmonicNumber2[n, -k])

s=Table[HarmonicNumber[n,-k]-Sum[Binomial[n+k-i+1,n-i]Binomial[k+1,j](i-j)^k(-1)^j,{i,k},{j,0,i-1}],
{n,10},{k,10}]

V7

Sum[Binomial[n+k-i+1,n-i]Binomial[k+1,j](i-j)^k(-1)^j,{i,k},{j,0,i-1}]

Table[Sum[Binomial[n+k-i+1,n-i]Binomial[k+1,j](i-j)^k(-1)^j,{i,k},{j,0,i-1}],{k,3}]//Simplify

Table[HarmonicNumber[n,-k],{k,3}]//Simplify

(1/((p-1)!))(∑_(n=0)^∞)(((x^n) (n+p-1)!)/(n!))==(((1-x))^(-p))

(1/((p-1)!))Sum[(((n+p-1)!)/(n!))(x^n),{n,0,∞}]

(1/((p-1)!))(∑_(n=0)^∞)(x^n) (Pochhammer[n+1, p-1])==(((1-x))^(-p))

(1/((p-1)!))Sum[Pochhammer[n+1,p-1](x^n),{n,0,∞}]

((((∑_(k=0)^n)(x^k)))^p)==(1/((p-1)!))(∑_(k=0)^(n p))(((x^k) (-(Abs[n-k])+n+p-1)!)/((n-(Abs[n-k]))!))/;p==1∨p==2

Sum[(x^k),{k,0,n}]

FullSimplify[Table[(1/((p-1)!))Sum[(((n-Abs[n-k]+p-1)!)/((n-Abs[n-k])!))(x^k),{k,0,n p}],{n,2}],p∈Integers&&p>0]

Table[%,{p,2}]//Factor

Subtract@@@Flatten[Table[{Sum[(x^k),{k,0,n}]^p,(1/((p-1)!))Sum[(((n-Abs[n-k]+p-1)!)/((n-Abs[n-k])!))(x^k),{k,0,n p}]},{p,2},{n,4}],1]//Simplify

With[{p=1},(1/((p-1)!))Sum[(((n-Abs[n-k]+p-1)!)/((n-Abs[n-k])!))(x^k),{k,0,n p}]]

With[{p=2},(1/((p-1)!))Sum[(((n-Abs[n-k]+p-1)!)/((n-Abs[n-k])!))(x^k),{k,0,n p}]]

With[{p=2},(1/((p-1)!))Sum[(((n-Abs[n-k]+p-1)!)/((n-Abs[n-k])!))(x^k),{k,0,n p},Assumptions->n∈Integers&&n>0]]

FullSimplify[%]

(1/((p-1)!))Sum[(((n-Abs[n-k]+p-1)!)/((n-Abs[n-k])!))(x^k),{k,0,n p}]

(1/((p-1)!))Sum[(((n-Abs[n-k]+p-1)!)/((n-Abs[n-k])!))(x^k),{k,0,n p}]

%/.p->2

V6

Table[Sum[(((x^k) (-1+k+p)!)/(k!)),{k,0,n}]+Sum[(((x^k) (-1-k+2 n+p)!)/((-k+2 n)!)),{k,n+1,n p}]//FullSimplify,{p,3}]

V7

Table[Sum[(((x^k) (-1+k+p)!)/(k!)),{k,0,n}]+Sum[(((x^k) (-1-k+2 n+p)!)/((-k+2 n)!)),{k,n+1,n p}]//FullSimplify,{p,3}]

((((∑_(n=0)^∞)a(n) (x^n)))^2)

With[{up=2},Table[{Sum[a[n]x^n,{n,0,up}]^2,Sum[((a[n])^2)(x^(2n)),{n,0,up}]+2Sum[Table[Plus@@(x^n Times@@a/@{i,j}/.{ToRules[Reduce[i+j==k&&0<=i<j,{i,j},Integers]]}),{k,n}],{n,up}]
},{n,2}]]

(∑_(i=0)^k)(Binomial[k+1, i]) (HarmonicNumber2[n, -i])+1==(((n+1))^(k+1))

Sum[(k^i),{k,n}]

1 + Sum[Binomial[k + 1, i]*HarmonicNumber[n, -i], {i, 0, k}]

Table[1 + Sum[Binomial[1 + k, i]*HarmonicNumber[n, -i], {i, 0, k}], {n, 3}, {k, 3}]

Table[(((1+n))^(k+1)),{n,3},{k,3}]

Powerfree

5th Powerfree

c=Position[Table[!PowerFreeQ[5,n],{n,1000}],True]//Flatten

Digits[n_]:=Floor[Log[10,n]]+1

cnt=0;
Do[
	If[PowerFreeQ[5,n],cnt++];
	If[Mod[n,10^(Digits[n]-1)]==0,Print[n,". ",cnt]],
		{n,10^6}
]

6th Powerfree

Digits[n_]:=Floor[Log[10,n]]+1

cnt=0;
Do[
	If[PowerFreeQ[6,n],cnt++];
	If[Mod[n,10^(Digits[n]-1)]==0,Print[n,". ",cnt]],
		{n,10^6}
]