Left Factorial

Author

Eric W. Weisstein
September 21, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Combinatorics/LeftFactorial.nb.

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

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

Sum

Sum[k!, {k, 0, n - 1}]

Sum[k!,{k,0,n-1}]

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

Definitions

(((-1))^n) n! !-n-1-!-1

Table[-Subfactorial[-1]+(((-1))^n) n! Subfactorial[-1-n],{n,0,10}]//FullSimplify

((n! (ExpIntegralE[n+1, -1])+Ei(1)+π i)/e)

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

(((((-1))^n) Γ(n+1) Γ(-n,-1)-Γ(0,-1))/e)

Table[(((((-1))^n) Gamma[1+n] Gamma[-n,-1]-Gamma[0,-1])/E),{n,0,10}]//FullSimplify

Recurrence

V6

RSolve[{a[n]==n a[n-1]-(n-1)a[n-2],a[0]==0,a[1]==1},a[n],n]

FullSimplify[%]

FullSimplify[{Gamma[0,-1], Gamma[1+n] Gamma[-n,-1],Gamma[-1,-1]+Gamma[0,-1]}]

Table[(((((-1))^n) Gamma[1+n] Gamma[-n,-1]-Gamma[0,-1])/E),{n,0,5}]//FullSimplify

LeafCount/@{(((((-1))^n) Gamma[1+n] Gamma[-n,-1]-Gamma[0,-1])/E),((I π+ExpIntegralEi[1]+ExpIntegralE[1+n,-1] Gamma[1+n])/E)}

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

V7

RSolve[{a[n]==n a[n-1]-(n-1)a[n-2],a[0]==0,a[1]==1},a[n],n]

FullSimplify[%]

ByteCount/@{((Subfactorial[-1]-(((-1))^n) n! Subfactorial[-1-n])/(Subfactorial[-2]+Subfactorial[-1])),((I π+ExpIntegralEi[1]+(((-1))^n) Gamma[1+n] Gamma[-n,-1])/E),-Subfactorial[-1]+(-1)^n n! Subfactorial[-1-n]}

FullSimplify[{((Subfactorial[-1]-(((-1))^n) n! Subfactorial[-1-n])/(Subfactorial[-2]+Subfactorial[-1])),((I π+ExpIntegralEi[1]+(((-1))^n) Gamma[1+n] Gamma[-n,-1])/E),-Subfactorial[-1]+(-1)^n n! Subfactorial[-1-n]}]

Generatig Function

Series[(ExpIntegralEi[1]-ExpIntegralEi[1-x])Exp[1-x],{x,0,5}]

...wrong...

CoefficientList[%,x]Factorial[Range[0,5]]

Primes

Position[Table[LeftFactorial[n]/2,{n,500}],_?PrimeQ]//Flatten//Timing

a=0;
Do[
If[Last[t=PrimeQ[(a+=(n-1)!)/2]//Timing],Print[{n,t}]];
If[Mod[n,100]==0,Print[n,"..."]],
{n,10^4}]

l={3,4,5,8,9,10,11,30,76,163,271,273,354,721,1796,3733,4769,9316,12221};

IntegerLength[LeftFactorial[Last[l]]/2]//Timing

Do[
Print[{n,l[[n]],PrimeQ[LeftFactorial[l[[n]]]/2]//Timing}],
{n,Length[l]}]