Factorial
Encyclopedia : F : FA : FAC : Factorial
In mathematics, the factorial of a natural number n is the product of all positive integers less than or equal to n. This is written as n! and pronounced "n factorial", or colloquially "n shriek" or "n bang". The notation n! was introduced by Christian Kramp in 1808.
The sequence of factorials (sequence in OEIS) for n = 0, 1, 2,... starts:
- 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800, 87178291200, 1307674368000, 20922789888000, 355687428096000, 6402373705728000, 121645100408832000, 2432902008176640000, ...
Definition
The factorial function is formally defined by
- [ n!=\prod_^n k \qquad \mbox n \ge 0. \!]
- [5 ! = 1\times 2 \times 3 \times 4 \times 5 = 120 \ ]
- [0! = 1 \ ]
- the recursive relation (n + 1)! = n! × (n + 1) works for n = 0;
- this definition makes many identities in combinatorics valid for zero sizes.
Non-integer factorials
The factorial function can also be defined for non-integer values, but this requires more advanced tools from mathematical analysis. The function that "fills in" the values of the factorial between the integers is called the Gamma function, denoted [\Gamma] and for z > −1 defined by
- [\Gamma(z+1)=\int_^ t^z e^\, \mathrmt. \!]
- [n!=n(n-1)! \,]
- [\Gamma(n+1)=n\Gamma(n) \,]
- [\Gamma(n+1)=n!\,\!]
- [(n+1/2)!=\sqrt\times \prod_^n .]
- [3.5! = \sqrt \cdot \cdot\cdot\cdot \approx 11.63.]
- Shared meaning. The canonical definition of the factorial function is the mentioned recursive relationship, shared by both.
- Context. The Gamma function is generally used in a context similar to that of the factorials (but, of course, where a more general domain is of interest).
- Uniqueness (Bohr–Mollerup theorem). The Gamma function is the only function which satisfies the mentioned recursive relationship for the domain of complex numbers and is holomorphic and whose restriction to the positive real axis is log-convex. That is, it is the only function that could possibly be a generalization of the factorial function.
Applications
- 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!.
- The volume of an n-dimensional hypersphere can be expressed as:
- Factorials are also used extensively in probability theory.
- Factorials are often used as a simple example, along with Fibonacci numbers, when teaching recursion in computer science because they satisfy the following recursive relationship (if n ≥ 1):
- [ n! = n \times (n-1)!. \,]
Number theory
Factorials have many applications in number theory. Factorial numbers are highly abundant numbers. In particular, n! is necessarily divisible by all prime numbers up to and including n. As a consequence, n > 4 is a composite number if and only if
- [(n-1)!\ \equiv\ 0 \ (\ n)].
- [(n-1)!\ \equiv\ -1 \ (\ n)]
Adrien-Marie Legendre found that the multiplicity of the prime p occurring in the prime factorization of n! can be expressed exactly as
- [\sum_^ \lfloor n/p^i \rfloor,]
The only factorial that is also a prime number is 2, but there are many primes of the form [n! \pm 1]. These are called factorial primes.
Rate of growth
As n grows, the factorial n! becomes larger than all polynomials and exponential functions in n.
When n is large, n! can be estimated quite accurately using Stirling's approximation:
- [n!\sim \sqrt\left(\frac\right)^n]
- [\left(\right)^n < n! < \left(\right)^n\ \mbox\ n\geq 6.\,]
- [\sum_^n]
A good approximation for log n! based on Stirling's approximation is
- [\ln(n!) \approx n\ln(n) - n + \frac + \frac .]
Computation
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. In practice, most software applications use only small factorials which can be computed by direct multiplication or table lookup. Larger values are often approximated in terms of floating-point estimates of the Gamma function, usually with Stirling's formula.
For number theoretic and combinatorial computations, very large exact factorials are often needed. Bignum factorials can be computed by direct multiplication, but multiplying the sequence 1×2×...×n from the bottom up (or top-down) is inefficient; it is better to recursively split the sequence so that the size of each subproduct is minimized.
The asymptotically-best efficiency is obtained by computing n! from its prime factorization. As documented by Peter Borwein, prime factorization allows n! to be computed in time O(n(log n log log n)2), provided that a fast multiplication algorithm is used (for example, Schönhage-Strassen multiplication).Peter Borwein. "On the Complexity of Calculating Factorials". Journal of Algorithms 6, 376-380 (1985) Peter Luschny presents source code and benchmarks for several efficient factorial algorithms, with or without the use of a prime sieve.Peter Luschny. [The Homepage of Factorial Algorithms].
Factorial-like products
Primorial
The primorial is similar to the factorial, but with the product taken only over the prime numbers.Multifactorials
A common related notation is to use multiple exclamation points to denote a multifactorial, the product of integers in steps of two (n!!), three (n!!!), or more.
n!! denotes the double factorial of n and is defined recursively by
- [ n!!= \left\ 1,\qquad\quad\ &&\mboxn=0\mboxn=1; \\ n(n-2)!!&&\mboxn\ge2.\qquad\qquad \end \right. ]
- [n!=n!!(n-1)!! \,]
- [(2n)!!=2^nn! \,]
- [(2n+1)!!==]
- [\Gamma\left(n+\right)=\sqrt\pi]
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
- [ n!^= \left\ 1,\qquad\qquad\ &&\mbox0\le n
Hyperfactorials
- Main article: Hyperfactorial
- [ H(n) =\prod_^n k^k =1^1\cdot2^2\cdot3^3\cdots(n-1)^\cdot n^n. ]
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.
Superfactorials
Neil Sloane and Simon Plouffe defined the superfactorial in 1995 as the product of the first n factorials. So the superfactorial of 4 is
- [ \mathrm(4)=1! \times 2! \times 3! \times 4!=288 \,]
- [ \mathrm(n) =\prod_^n k! =\prod_^n k^ =1^n\cdot2^\cdot3^\cdots(n-1)^2\cdot n^1. ]
This idea was extended in 2000 by Henry Bottomley to the superduperfactorial as the product of the first n superfactorials, starting (from n = 0) as
- 1, 1, 2, 24, 6912, 238878720, 5944066965504000, ... (sequence in OEIS)
- [\mathrm(n,m) = \mathrm(n-1,m)\mathrm(n,m-1) =\prod_^n k^ ]
Superfactorials (alternative definition)
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
- [n\$\equiv \begin \underbrace}}} \\ n! \end \,],
- [n\$=n!^n! \,]
- [n\$=(n!)\uparrow\uparrow(n!) \,]
- [1\$=1 \,]
- [2\$=2^2=4 \,]
- [3\$=6\uparrow\uparrow6=6^}}} \!=8.02\times 10^]
See also
References
External links
- [Factorial Calculator]
- [table of 2! - 256! (exact)]
- http://factorielle.free.fr
- [The Dictionary of Large Numbers]
- [The first 999 factorials]
- , [Factorial] at MathWorld.
- This article incorporates material from on PlanetMath, which is licensed under the [Text of the GNU Free Documentation LicenseGFDL].
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
