TOPICS
Search

Alternating Factorial


The alternating factorial is defined as the sum of consecutive factorials with alternating signs,

 a(n)=sum_(k=1)^n(-1)^(n-k)k!.
(1)

They can be given in closed form as

 a(n)=(-1)^n[-1-eEi(-1)+(-1)^nE_(n+2)(1)Gamma(n+2)],
(2)

where Ei(x) is the exponential integral, E_n(x) is the En-function, and Gamma(x) is the gamma function.

The alternating factorial will is implemented in the Wolfram Language as AlternatingFactorial[n].

A simple recurrence equation for a(n) is given by

 a(n)=n!-a(n-1),
(3)

where a(1)=1.

For n=1, 2, ..., the first few values are 1, 1, 5, 19, 101, 619, 4421, 35899, ... (OEIS A005165).

The first few values n for which a(n) are (probable) primes are n=3, 4, 5, 6, 7, 8, 10, 15, 19, 41, 59, 61, 105, 160, 661, 2653, 3069, 3943, 4053, 4998, 8275, 9158, 11164, 43592, 59961, ... (OEIS A001272; extending Guy 1994, p. 100). Živković (1999) has shown that the number of such primes is finite. a(661) was verified to be prime in Jul. 2000 by team of G. La Barbera and others using the Certifix program developed by Marcel Martin.

The following table summarizes the largest known alternating factorial probable primes. M. Rodenkirch completed a search up n=100000 in December 2017 showing there are no further (probable) primes up to that limit.

ndecimal digitsdiscoverer
1116440344P. Jobbing, Nov. 25, 2004
43592183312S. Balatov, Jul. 19, 2017
59961260448M. Rodenkirch, Sep. 18, 2017

See also

Factorial, Factorial Sums

Explore with Wolfram|Alpha

References

Balatov, S. "Alternating Factorials." Jul. 19, 2017. http://www.mersenneforum.org/showpost.php?p=463778&postcount=7.Guy, R. K. "Equal Products of Factorials," "Alternating Sums of Factorials," and "Equations Involving Factorial n." §B23, B43, and D25 in Unsolved Problems in Number Theory, 2nd ed. New York: Springer-Verlag, pp. 80, 100, and 193-194, 1994.Jobling, P. "Guy's Problem B43: Search for Primes of Form n!-(n-1)!+(n-2)!-(n-3)!+...+/-1!." 25 Nov 2004. http://listserv.nodak.edu/scripts/wa.exe?A1=ind0411&L=nmbrthry#4.Rodenkirch, M. "Alternating Factorials." Dec. 15, 2017. http://www.mersenneforum.org/showthread.php?p=474083#post474083.Sloane, N. J. A. Sequences A001272, A005165/M3892 in "The On-Line Encyclopedia of Integer Sequences."Živković, M. "The Number of Primes sum_(i=1)^(n)(-1)^(n-i)i! is Finite." Math. Comput. 68, 403-409, 1999.

Referenced on Wolfram|Alpha

Alternating Factorial

Cite this as:

Weisstein, Eric W. "Alternating Factorial." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/AlternatingFactorial.html

Subject classifications