Factorial Sums

Author

Eric W. Weisstein
August 11, 2017

This notebook downloaded from http://mathworld.wolfram.com/notebooks/SpecialFunctions/FactorialSums.nb.

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

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

Simple Sums

(∑_(k=1)^n)k!

A007489

V5

Sum[k!,{k,n}]//TraditionalForm

FullSimplify[%,n∈Integers&&n>1]

V7

Sum[k!,{k,n}]

FullSimplify[%,n∈Integers&&n>1]

Formula

Table[Sum[k!,{k,n}],{n,10}]

Table[(1/E)(-E+I π+ExpIntegralEi[1]+ExpIntegralE[2+n,-1] Gamma[2+n]),{n,10}]//FullSimplify

Limit[(1/E)(-E+I π+ExpIntegralEi[1]+ExpIntegralE[2+n,-1] Gamma[2+n]),n->∞]

Primes

Divisible by 3 for n > 2, so a(2) == 3 is the only prime

Table[Sum[k!,{k,n}],{n,10}]//FactorInteger[#,Automatic]&//Column

(∑_(k=1)^n)k k!

A033312

V6

Sum[k k!,{k,n}]//TraditionalForm

V7

Sum[k k!,{k,n}]

Explicit sum

Table[Sum[k k!,{k,n}],{n,20}]

(∑_(k=1)^n)((k!)^2)

A104344

V5

Sum[k!^2,{k,n}]

Table[HypergeometricPFQ[{1,2,2},{},1]-((Gamma[2+n])^2) HypergeometricPFQ[{1,2+n,2+n},{},1],{n,5}]

N[%,20]

...wrong,,,

V6

Sum[k!^2,{k,n}]

V7

Sum[Gamma[k+1]^2,{k,n}]

Sum[k!^2,{k,n}]

FunctionExpand[%]

Table[DifferenceRoot[Function[{𝓎,𝓃},{(1+2 𝓃+(𝓃^2)) 𝓎[𝓃]+(-2-2 𝓃-(𝓃^2)) 𝓎[1+𝓃]+𝓎[2+𝓃]==0,𝓎[1]==0,𝓎[2]==1}]][1+n],{n,10}]

Explicit sum

Table[Sum[k!^2,{k,n}],{n,10}]

Primes

A100289

Position[Table[Sum[k!^2,{k,n}],{n,100}],_?PrimeQ]//Flatten//Timing

l={2,3,4,5,7,8,10,18,21,42,51,91,133,177,182,310,3175,9566,32841};

f=Range[l[[-1]]]!;//Timing

f=FoldList[Times,1,Range[2,l[[-1]]]];//Timing

TextGrid[MapIndexed[{#2[[1]],#,IntegerLength[Total[Take[f,#]^2]]}&,l],Dividers->All,Alignment->Decimal]

Do[
Print[{n,l[[n]],PrimeQ[Sum[k!^2,{k,l[[n]]}]]//Timing}],
{n,Length[l]}]

(∑_(k=1)^n)((k!)^3)

A138564

V12

Sum[k!^2,{k,n}]

FunctionExpand[%]

Explicit sum

Table[Sum[k!^3,{k,n}],{n,10}]

(No) primes

Divisible by 9 for n > 1, so no primes

Table[Sum[k!^3,{k,n}],{n,10}]//FactorInteger[#,Automatic]&//Column

(∑_(k=1)^n)((k!)^4)

A289945

V12

Sum[k!^4,{k,n}]

FunctionExpand[%]

Explicit sum

Table[Sum[k!^4,{k,n}],{n,15}]

Primes

The only prime in this sequence is a(2) = 17 since a(n) is divisible by 13 for n >= 12 and there are no other primes with n < 12.

Table[Sum[k!^4,{k,n}],{n,20}]//FactorInteger[#,Automatic]&//Column

Mod[Table[Sum[k!^4,{k,n}],{n,100}],13]

FactorInteger[Sum[k!^4,{k,12}]]

Position[Table[Sum[k!^4,{k,n}],{n,10^3}],_?PrimeQ]//Flatten//Timing

Position[Table[Sum[k!^4,{k,n}],{n,2000}],_?PrimeQ]//Flatten//Timing

Position[Table[Sum[k!^4,{k,n}],{n,3000}],_?PrimeQ]//Flatten//Timing

(∑_(k=1)^n)((k!)^5)

V12

Sum[k!^5,{k,n}]

Explicit sum

Table[Sum[k!^5,{k,n}],{n,10}]

(No) primes

Divisible by 3 for n > 1, so no primes

Table[Sum[k!^5,{k,n}],{n,10}]//FactorInteger[#,Automatic]&//Column

(∑_(k=1)^n)((k!)^6)

A289946

V12

Sum[k!^6,{k,n}]

Explicit sum

Table[Sum[k!^6,{k,n}],{n,10}]

Primes

A289947

Seem to be fairly rare (but take a long time to compute)

With[{n=34},Sum[k!^6,{k,n}]]

Table[Sum[k!^6,{k,n}],{n,10}]//FactorInteger[#,Automatic]&//Column

Position[Table[Sum[k!^6,{k,n}],{n,10^3}],_?PrimeQ]//Flatten//Timing

Position[Table[Sum[k!^6,{k,n}],{n,2000}],_?PrimeQ]//Flatten//Timing

PrimeQ[val=With[{n=1090},Sum[k!^6,{k,n}]]]//Timing

IntegerLength[val=With[{n=1090},Sum[k!^6,{k,n}]]]

Mod[val,1091]

Table[{n,Mod[Sum[k!^6,{k,n}],1091]},{n,1080,1100}]

FactorInteger[With[{n=1090},Sum[k!^6,{k,n}]],Automatic]//Timing

FactorInteger[With[{n=104},Sum[k!^6,{k,n}]]]//Timing

Position[Monitor[Table[Sum[k!^6,{k,n}],{n,2001,3000}],n],_?PrimeQ]//Flatten//Timing

Position[Monitor[Table[Sum[k!^6,{k,n}],{n,3001,10000}],n],_?PrimeQ]//Flatten//Timing

IntegerLength/@Table[Sum[k!^6,{k,n}],{n,{5,34,102}}]

(∑_(k=1)^n)((k!)^7)

V12

Sum[k!^7,{k,n}]

Explicit sum

Table[Sum[k!^7,{k,n}],{n,10}]

(No) primes

Divisible by 3 for n > 1, so no primes

Table[Sum[k!^7,{k,n}],{n,10}]//FactorInteger[#,Automatic]&//Column

(∑_(k=1)^n)((k!)^8)

V11.2

Sum[k!^8,{k,n}]

Explicit sum

Table[Sum[k!^8,{k,n}],{n,10}]

Primes

a(2) = 257 is the only prime since a(n) is divisible by 13 for n>=12

Table[Sum[k!^8,{k,n}],{n,15}]//FactorInteger[#,Automatic]&//Column

Mod[Table[Sum[k!^8,{k,n}],{n,20}],13]

(∑_(k=1)^n)((k!)^9)

(No) primes

Divisible by 3 for n > 1, so no primes

Table[Sum[k!^9,{k,n}],{n,10}]//FactorInteger[#,Automatic]&//Column

(∑_(k=1)^n)((k!)^10)

V11.2

Sum[k!^10,{k,n}]

Explicit sum

Table[Sum[k!^10,{k,n}],{n,10}]

Primes

A290014

Only primes are 3, 4, 5, 16, 25

Position[Table[Sum[k!^10,{k,n}],{n,1000}],_?PrimeQ]//Flatten//Timing

Table[Sum[k!^10,{k,n}],{n,{3,4,5}}]

PrimeQ/@%

IntegerLength/@Table[Sum[k!^10,{k,n}],{n,{3,4,5,16,25}}]

Table[Sum[k!^10,{k,n}],{n,30,50}]//FactorInteger[#,Automatic]&//Column

Mod[Table[Sum[k!^10,{k,n}],{n,30,50}],41]

29+Position[%,0]//Flatten

Sequence of numbers for p = 2, 4, ... for which mod[sum..., k], k == 0

A290250

2 is hard

Total[FoldList[Times,Range[5*^4]]^2]//IntegerLength//Timing

According to A100289, the sum must be carried out to 1248829 terms to get Mod[sum, 1248829] == 0

PrimeQ[1248829]

DivisibleFactorialSum[p_]:=Module[{sum=1,fac=1,k=2},
Monitor[While[!Divisible[sum+=(fac*=k)^p,k],k++],{p,k}];
{k,IntegerLength[sum]}
]

Do[Print[{n,DivisibleFactorialSum[n]//Timing}],{n,2,2}]

Sum[k!^4,{k,13}]

Divisible[Sum[k!^4,{k,13}],13]

IntegerLength[sum6=Sum[k!^6,{k,1091}]]

Divisible[sum6,1091]

Do[Print[{n,DivisibleFactorialSum[n]//Timing}],{n,4,34,2}]

For n==36, value > 73525

Mod[Table[Sum[(((k!))^4),{k,n}],{n,38}],13]

Divisible[Sum[(((k!))^4),{k,11}],13]

Divisible[p12=Sum[(((k!))^4),{k,12}],13]

Divisible[p13=Sum[(((k!))^4),{k,13}],13]

IntegerLength/@{p12,p13}

Timings

Clear[DivisibleFactorialSum2]

DivisibleFactorialSum1[p_,kmax_:2*^4]:=Module[{sum=1,fac=1,k=2},
Monitor[While[k≤kmax&&Mod[sum+=(fac*=k)^p,k]=!=0,k++],{p,k}];
k
]

DivisibleFactorialSum1[6]//Timing

DivisibleFactorialSum1[2]//Timing

DivisibleFactorialSum2[p_,kmax_:2*^4]:=Module[{sum=1,fac=1,k=2},
Monitor[While[k≤kmax&&!Divisible[sum+=(fac*=k)^p,k],k++],{p,k}];
k
]

DivisibleFactorialSum2[6]//Timing

DivisibleFactorialSum2[2]//Timing

DivisibleFactorialSum3[p_,kmax_:2*^4]:=Module[{sum=1,fac=1,k=2},
While[k≤kmax&&!Divisible[sum+=(fac*=k)^p,k],k++];
k
]

DivisibleFactorialSum3[6]//Timing

DivisibleFactorialSum3[2]//Timing

DivisibleFactorialSum4[p_,kmax_:2*^4]:=Module[{sum=1,fac=1,k=2},
Monitor[While[k≤kmax&&!Divisible[sum+=(fac*=k)^p,k],k++],{p,k,IntegerLength[sum]}];
k
]

DivisibleFactorialSum4[6]//Timing

DivisibleFactorialSum4[2]//Timing

Sums with k! in the Denominator

(∑_(k=0)^∞)(1/(k!))==e

Sum[(1/(k!)),{k,0,∞}]

(∑_(k=0)^∞)((((-1))^k)/(k!))==(1/e)

Sum[((((-1))^k)/(k!)),{k,0,∞}]

(∑_(k=0)^∞)(1/(((k!))^2))==(Subscript[I, 0])(2)

Sum[(1/(((k!))^2)),{k,0,∞}]

(∑_(k=0)^∞)((((-1))^k)/(((k!))^2))==(Subscript[J, 0])(2)

Sum[((((-1))^k)/(((k!))^2)),{k,0,∞}]

(∑_(k=0)^∞)(1/((2 k)!))==cosh(1)

Sum[(1/((2k)!)),{k,0,∞}]

FullSimplify[%]

(∑_(k=0)^∞)((((-1))^k)/((2 k)!))==cos(1)

Sum[((((-1))^k)/((2k)!)),{k,0,∞}]

FullSimplify[%]

(∑_(k=0)^∞)(1/((2 k+1)!))==sinh(1)

Sum[(1/((2k+1)!)),{k,0,∞}]

FullSimplify[%]

(∑_(k=0)^∞)((((-1))^k)/((2 k+1)!))==sin(1)

Sum[((((-1))^k)/((2k+1)!)),{k,0,∞}]

FullSimplify[%]

General Sums

(∑_(k=0)^∞)(1/((k n)!))

Sum[(1/((n k)!)),{k,0,∞}]

sum[n_]:=HypergeometricPFQ[{},Range[n-1]/n,1/n^n]

Table[Sum[(1/((n k)!)),{k,0,∞}],{n,6}]//FullSimplify

Table[sum[k],{k,6}]//FullSimplify

(∑_(k=0)^∞)(1/((k n+1)!))

sum[n_,k_]:=HypergeometricPFQ[{},DeleteCases[Range[k+1,n+k]/n,1],1/n^n]/k

Table[Sum[(1/((n k+1)!)),{k,0,∞}],{n,12}]//FullSimplify

Table[sum[k,1],{k,12}]//FullSimplify

(∑_(k=0)^∞)(1/((k n+2)!))

Table[Sum[(1/((n k+2)!)),{k,0,∞}],{n,12}]//FullSimplify

Table[sum[k,2],{k,12}]//FullSimplify

Schroeppel and Gosper

(∑_(n=0)^∞)((((n!))^2)/((2 n)!))==(2/27) (π (Sqrt[3])+18)

Sum[(((n!)^2)/((2n)!)),{n,0,∞}]

(∑_(n=0)^∞)((((n!))^3)/((3 n)!))==(Subscript[, 3])(Subscript[F, 2])(1,1,1;(1/3),(2/3);(1/27))

Sum[(((n!)^3)/((3n)!)),{n,0,∞}]

P[t_]:=(2(8+7t^2-7t^3)/(4-t^2+t^3)^2)
Q[t_]:=(4t(1-t)(5+t^2-t^3)/(4-t^2+t^3)^2/Sqrt[(1-t)(4-t^2+t^3)])
R[t_]:=1-1/2(t^2-t^3)

Integrate[P[t]+Q[t]ArcCos[R[t]],{t,0,1}]

FullSimplify[P[t]+Q[t]ArcCos[R[t]],0<t<1]

Integrate[((2 (8-7 (-1+t) (t^2)+((2 (-1+t) t (-5+(-1+t) (t^2)) ArcCos[(1/2) (2+(-1+t) (t^2))])/(Sqrt[-(-1+t) (4+(-1+t) (t^2))]))))/(((4+(-1+t) (t^2)))^2)),{t,0,1}]

{
NIntegrate[P[t]+Q[t]ArcCos[R[t]],{t,0,1}],
HypergeometricPFQ[{1,1,1},{(1/3),(2/3)},(1/27)]//N
}

(∑_(n=0)^∞)((((n!))^4)/((4 n)!))==(Subscript[, 4])(Subscript[F, 3])(1,1,1,1;(1/4),(1/2),(3/4);(1/256))

Sum[(((n!)^4)/((4n)!)),{n,0,∞}]

(∑_(n=0)^∞)((((n!))^5)/((5 n)!))==(Subscript[, 5])(Subscript[F, 4])(1,1,1,1,1;(1/5),(2/5),(3/5),(4/5);(1/3125))

Sum[(((n!)^5)/((5n)!)),{n,0,∞}]

Table[i^i,{i,5}]

Symbolic Factorial Sums

(∑_(k=1)^N)(1/((k+m)! (k+n)!))

Sum[(1/((k+m)!(k+n)!)),{k,0,N}]//FullSimplify//TraditionalForm

(∑_(k=0)^N)(1/((m+k)! (n-k)!))

Sum[(1/((m+k)!(n-k)!)),{k,0,N}]//FullSimplify//TraditionalForm