| |||||||||
In mathematics, the factorial of a natural number n is the product of the positive integers less than or equal to n. This is written as n! and pronounced "n factorial". The notation n! was introduced by Christian Kramp in 1808.
Since the exclamation mark, "!", is sometimes pronounced "bang" or "shriek", these words are occasionally used colloquially for "factorial" in pronouncing equations like n!.
The factorial function is formally defined by
For example,
This definition implies in particular that
because the product of no numbers at all is 1 (see empty product for an account of that fact). Proper attention to the value of the empty product is important in this case, because
The factorial function can also be defined (for non-integer values of z), via the gamma function:
The sequence of factorials (sequence in OEIS) for n = 0, 1, 2,... starts:
Factorials are important in combinatorics. For example, there are n! different ways of arranging n distinct objects in a sequence. (The arrangements are called permutations.) And the number of ways one can choose k objects from among a given set of n objects (the number of combinations), is given by the so-called binomial coefficient
Factorials also turn up in calculus. For example, Taylor's theorem expresses a function f(x) as a power series in x, basically because the n-th derivative of xn is n!. Factorials are also used extensively in probability theory.
Factorials are often used as a simple example when teaching recursion in computer science because they satisfy the following recursive relationship (if n ≥ 1):
The numeric value of n! can be calculated by repeated multiplication if n is not too large. That is basically what pocket calculators do. The largest factorial that most calculators can handle is 69!, because 70! > 10100.
When n is large, n! can be estimated quite accurately using Stirling's approximation:
The related gamma function Γ(z) is defined for all complex numbers z except for the nonpositive integers (z = 0, −1, −2, −3, ...). It is related to factorials in that it satisfies a recursive relationship similar to that of the factorial function:
Together with the definition Γ(1) = 1 this yields the equation
Because of this relationship, the gamma function is often thought of as a generalization of the factorial function to the domain of complex numbers. This is justified for the following reasons.
Some identities involving double factorials are:
One should be careful not to interpret n!! as the factorial of n!, which would be written (n!)! and is a much larger number.
The double factorial is the most commonly used variant, but one can similarly define the triple factorial (n!!!) and so on. In general, the k-th factorial, denoted by n!(k), is defined recursively as
Occasionally the hyperfactorial of n is considered. It is written as H(n) and defined by
For n = 1, 2, 3, 4,... the values of H(n) are 1, 4, 108, 27648,... (sequence in OEIS).
The hyperfactorial function is similar to the factorial, but produces larger numbers. The rate of growth of this function, however, is not much larger than a regular factorial.
Neil Sloane and Simon Plouffe defined the superfactorial in 1995 as the product of the first n factorials. So the superfactorial of 4 is
In general
The sequence of superfactorials starts (from n=0) as
This idea can easily be extended to the superduperfactorial as the product of the first n superfactorials, starting (from n=0) as
and thus recursively to any multiple-level factorial where the mth-level factorial of n is the product of the first n (m-1)th-level factorials, i.e.
where <math>\mathrm{mf}(n,0)=n<math> for <math>n>0<math> and <math>\mathrm{mf}(0,m)=1<math>.
Clifford Pickover in his 1995 book Keys to Infinity defined the superfactorial of n, written as n$ (the $ should really be a factorial sign ! with an S superimposed) as
where the (4) notation denotes the hyper4 operator, or using Knuth's up-arrow notation,
This sequence of superfactorials starts: