## Factorial

The factorial is defined for a Positive Integer as

 (1)

The first few factorials for , 1, 2, ... are 1, 1, 2, 6, 24, 120, ... (Sloane's A000142). An older Notation for the factorial is (Dudeney 1970, Gardner 1978, Conway and Guy 1996).

As grows large, factorials begin acquiring tails of trailing Zeros. To calculate the number of trailing Zeros for , use

 (2)

where
 (3)

and is the Floor Function (Gardner 1978, p. 63; Ogilvy and Anderson 1988, pp. 112-114). For , 2, ..., the number of trailing zeros are 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, ... (Sloane's A027868). This is a special application of the general result that the Power of a Prime dividing is
 (4)

(Graham et al. 1994, Vardi 1991). Stated another way, the exact Power of a Prime which divides is
 (5)

By noting that

 (6)

where is the Gamma Function for Integers , the definition can be generalized to Complex values
 (7)

This defines for all Complex values of , except when is a Negative Integer, in which case . Using the identities for Gamma Functions, the values of (half integral values) can be written explicitly
 (8) (9) (10) (11)

where is a Double Factorial.

For Integers and with ,

 (12)

The Logarithm of is frequently encountered

 (13) (14) (15) (16) (17) (18) (19)

where is the Euler-Mascheroni Constant, is the Riemann Zeta Function, and is the Polygamma Function. The factorial can be expanded in a series

 (20)

Stirling's Series gives the series expansion for ,

 (21)

where is a Bernoulli Number.

Identities satisfied by sums of factorials include

 (22) (23) (24) (25) (26) (27) (28) (29)

(Spanier and Oldham 1987), where is a Modified Bessel Function of the First Kind, is a Bessel Function of the First Kind, cosh is the Hyperbolic Cosine, cos is the Cosine, sinh is the Hyperbolic Sine, and sin is the Sine.

Let be the exponent of the greatest Power of a Prime dividing . Then

 (30)

Let be the number of 1s in the Binary representation of . Then
 (31)

(Honsberger 1976). In general, as discovered by Legendre in 1808, the Power of the Prime dividing is given by
 (32)

where the Integers , ..., are the digits of in base (Ribenboim 1989).

The sum-of-factorials function is defined by

 (33) (34)

where is the Exponential Integral, is the En-Function, and i is the Imaginary Number. The first few values are 1, 3, 9, 33, 153, 873, 5913, 46233, 409113, ... (Sloane's A007489). cannot be written as a hypergeometric term plus a constant (Petkovsek et al. 1996). However the sum
 (35)

has a simple form, with the first few values being 1, 5, 23, 119, 719, 5039, ... (Sloane's A033312).

The numbers are prime for , 2, 3, 11, 27, 37, 41, 73, 77, 116, 154, ... (Sloane's A002981), and the numbers are prime for , 4, 6, 7, 12, 14, 30, 32, 33, 38, 94, 166, ... (Sloane's A002982). In general, the power-product sequences (Mudge 1997) are given by . The first few terms of are 2, 5, 37, 577, 14401, 518401, ... (Sloane's A020549), and is Prime for , 2, 3, 4, 5, 9, 10, 11, 13, 24, 65, 76, ... (Sloane's A046029). The first few terms of are 0, 3, 35, 575, 14399, 518399, ... (Sloane's A046032), but is Prime for only since for . The first few terms of are 0, 7, 215, 13823, 1727999, ... (Sloane's A0460333), and the first few terms of are 2, 9, 217, 13825, 1728001, ... (Sloane's A019514).

There are only four Integers equal to the sum of the factorials of their digits. Such numbers are called Factorions. While no factorial is a Square Number, D. Hoey listed sums of distinct factorials which give Square Numbers, and J.  McCranie gave the one additional sum less than :

(Sloane's A014597). The first few values for which the alternating Sum
 (36)

is Prime are 3, 4, 5, 6, 7, 8, 41, 59, 61, 105, 160, ... (Sloane's A014615, Guy 1994, p. 100). The only known factorials which are products of factorial in an Arithmetic Sequence are

There are no identities of the form

 (37)

for with for for except
 (38) (39) (40)

(Guy 1994, p. 80).

There are three numbers less than 200,000 for which

 (41)

namely 5, 13, and 563 (Le Lionnais 1983). Brown Numbers are pairs of Integers satisfying the condition of Brocard's Problem, i.e., such that
 (42)

Only three such numbers are known: (5, 4), (11, 5), (71, 7). Erdös conjectured that these are the only three such pairs (Guy 1994, p. 193).

See also Alladi-Grinstead Constant, Brocard's Problem, Brown Numbers, Double Factorial, Factorial Prime, Factorion, Gamma Function, Hyperfactorial, Multifactorial, Pochhammer Symbol, Primorial, Roman Factorial, Stirling's Series, Subfactorial, Superfactorial

References

Conway, J. H. and Guy, R. K. Factorial Numbers.'' In The Book of Numbers. New York: Springer-Verlag, pp. 65-66, 1996.

Dudeney, H. E. Amusements in Mathematics. New York: Dover, p. 96, 1970.

Gardner, M. Factorial Oddities.'' Ch. 4 in Mathematical Magic Show: More Puzzles, Games, Diversions, Illusions and Other Mathematical Sleight-of-Mind from Scientific American. New York: Vintage, pp. 50-65, 1978.

Graham, R. L.; Knuth, D. E.; and Patashnik, O. Factorial Factors.'' §4.4 in Concrete Mathematics: A Foundation for Computer Science. Reading, MA: Addison-Wesley, pp. 111--115, 1990.

Guy, R. K. Equal Products of Factorials,'' Alternating Sums of Factorials,'' and Equations Involving Factorial .'' §B23, B43, and D25 in Unsolved Problems in Number Theory, 2nd ed. New York: Springer-Verlag, pp. 80, 100, and 193-194, 1994.

Honsberger, R. Mathematical Gems II. Washington, DC: Math. Assoc. Amer., p. 2, 1976.

Le Lionnais, F. Les nombres remarquables. Paris: Hermann, p. 56, 1983.

Leyland, P. ftp://sable.ox.ac.uk/pub/math/factors/factorial-.Z and ftp://sable.ox.ac.uk/pub/math/factors/factorial+.Z.

Madachy, J. S. Madachy's Mathematical Recreations. New York: Dover, p. 174, 1979.

Mudge, M. Not Numerology but Numeralogy!'' Personal Computer World, 279-280, 1997.

Ogilvy, C. S. and Anderson, J. T. Excursions in Number Theory. New York: Dover, 1988.

Petkovsek, M.; Wilf, H. S.; and Zeilberger, D. A=B. Wellesley, MA: A. K. Peters, p. 86, 1996.

Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling, W. T. Gamma Function, Beta Function, Factorials, Binomial Coefficients.'' §6.1 in Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed. Cambridge, England: Cambridge University Press, pp. 206-209, 1992.

Ribenboim, P. The Book of Prime Number Records, 2nd ed. New York: Springer-Verlag, pp. 22-24, 1989.

Sloane, N. J. A. Sequences A014615, A014597, A033312, A020549, A000142/M1675, and A007489/M2818 in An On-Line Version of the Encyclopedia of Integer Sequences.'' http://www.research.att.com/~njas/sequences/eisonline.html.

Spanier, J. and Oldham, K. B. The Factorial Function and Its Reciprocal.'' Ch. 2 in An Atlas of Functions. Washington, DC: Hemisphere, pp. 19-33, 1987.

Vardi, I. Computational Recreations in Mathematica. Reading, MA: Addison-Wesley, p. 67, 1991.