Static Wikipedia February 2008 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu

Web Analytics
Cookie Policy Terms and Conditions Factorial - Wikipedia, the free encyclopedia

Factorial

From Wikipedia, the free encyclopedia

n n!
0 1
1 1
2 2
3 6
4 24
5 120
6 720
7 5040
8 40320
9 362880
10 3628800
15 1307674368000
20 2432902008176640000
25 15511210043330985984000000
50 3.04140932... × 1064
70 1.19785717... × 10100
450 1.73368733... × 101,000
3249 6.41233768... × 1010,000
25206 1.205703438... × 10100,000
The first few and selected larger members of the sequence of factorials (sequence A000142 in OEIS)

In mathematics, the factorial of a positive integer 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", "n bang" or "n crit". The notation n! was introduced by Christian Kramp in 1808.

Contents

[edit] Definition

The factorial function is formally defined by

n!=\prod_{k=1}^n k \qquad \mbox{for all } n \in \mathbb{N}\!

For example,

5 ! = 1\cdot 2 \cdot 3 \cdot 4 \cdot 5 = 120 \

The above definition incorporates the convention that

0! = 1 \

as an instance of the convention that the product of no numbers at all is 1. This fact for factorials is useful, because

  • the recursive relation (n + 1)! = n! \times (n + 1) works for n = 0;
  • this definition makes many identities in combinatorics valid for zero sizes.
    • In particular, the number of combinations or permutations of an empty set is, clearly, 1.

[edit] Non-integer factorials

The Gamma function, as plotted here along the real axis, extends the factorial to a smooth function defined for all non-integer values.
The Gamma function, as plotted here along the real axis, extends the factorial to a smooth function defined for all non-integer values.

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 Γ(z) and for z \neq 0, -1, -2, \dots defined by

\Gamma(z)=\int_{0}^{\infty} t^{z-1} e^{-t}\, \mathrm{d}t. \!

Euler's original formula for the Gamma function was

\Gamma(z)=\lim_{n\to\infty}\frac{n^zn!}{\prod_{k=0}^n(z+k)}. \!

The Gamma function is related to factorials in that it satisfies a similar recursive relationship:

n!=n(n-1)! \,
\Gamma(n+1)=n\Gamma(n) \,

Together with Γ(1) = 1 this yields the equation for any nonnegative integer n:

\Gamma(n+1)=n!\,\!
\left (\frac{1}{2}\right )! = \frac{\sqrt{\pi}}{2}

Based on the Gamma function's value for 1/2, the specific example of half-integer factorials is resolved to

\left (n+\frac{1}{2}\right )!=\sqrt{\pi}\times \prod_{k=0}^n {2k + 1 \over 2}.

For example

3.5! = \sqrt{\pi} \cdot {1\over 2}\cdot{3\over2}\cdot{5\over2}\cdot{7\over2} \approx 11.63.

The Gamma function is in fact defined for all complex numbers z except for the nonpositive integers (z = 0, − 1, − 2,...). It is often thought of as a generalization of the factorial function to the complex domain, which is justified for the following reasons:

  • Shared meaning. The canonical definition of the factorial function shares the same recursive relationship with the Gamma function.
  • 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 aforementioned recursive relationship for the domain of complex numbers, is meromorphic, and is log-convex on the positive real axis. That is, it is the only smooth, log-convex function that could be a generalization of the factorial function to all complex numbers.

[edit] 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
{n\choose k}={n!\over k!(n-k)!}.
  • In permutations, if r objects can be chosen and arranged in r different ways from a total of n objects, where r < = n, then the total number of distinct permutations is given by:
{}_nP_r = \frac{n!}{(n-r)!}.
V_n={\pi^{n/2}R^n\over (n/2)!}.

Note that the Gamma function is required for odd dimensions and that its value cancels out the apparent fractional power of π in those cases.

n! = n \times (n-1)!.\,

[edit] Number theory

Factorials have many applications in number theory. 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 \ ({\rm mod}\ n).

A stronger result is Wilson's theorem, which states that

(p-1)!\ \equiv\ -1 \ ({\rm mod}\ p)

if and only if p is prime.

Adrien-Marie Legendre found that the multiplicity of the prime p occurring in the prime factorization of n! can be expressed exactly as

\sum_{i=1}^{\infty} \lfloor n/p^i \rfloor,

which is finite since the floor function removes all pi > n.

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.

[edit] Rate of growth

Plot of the natural logarithm of the factorial
Plot of the natural logarithm of the factorial

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!\approx \sqrt{2\pi n}\left(\frac{n}{e}\right)^n.

A weak version that can be proved with mathematical induction is

\left({n \over 3}\right)^n < n! < \left({n \over 2}\right)^n\ \mbox{if}\ n\geq 6.\,

The logarithm of the factorial can be used to calculate the number of digits in a given base the factorial of a given number will take. log(n!) can easily be calculated as follows:

\sum_{k=1}^n{\log k}.

Note that this function, if graphed, is approximately linear, for small values; but the factor {\log n!} \over n does grow arbitrarily large, although quite slowly. The graph of log(n!) for n between 0 and 20,000 is shown in the figure on the right.

A simple approximation for ln(n!) based on Stirling's approximation is

\ln(n!) \approx n\ln(n) - n + \frac {\ln(n)} {2} + \frac {\ln(2 \pi)} {2}.

A much better approximation for ln(n!) was given by Srinivasa Ramanujan

\ln(n!) \approx n\ln(n) - n + \frac {\ln(n(1+4n(1+2n)))} {6} + \frac {\ln(\pi)} {2}.

One can see from this that log(n!) is Ο(n log n). This result plays a key role in the analysis of the computational complexity of sorting algorithms (see comparison sort).

[edit] 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 \times 2 \times ... \times 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, the Schönhage-Strassen algorithm).[1] Peter Luschny presents source code and benchmarks for several efficient factorial algorithms, with or without the use of a prime sieve.[2]

[edit] Factorial-like products

There are several other integer sequences similar to the factorial that are used in mathematics:

[edit] Primorial

The primorial (sequence A002110 in OEIS) is similar to the factorial, but with the product taken only over the prime numbers.

[edit] Double factorial

n!! denotes the double factorial of n and is defined recursively by

n!!=   \left\{    \begin{matrix}     1,\qquad\quad\ &&\mbox{if }n=-1\mbox{ or }n=0\mbox{ or }n=1;    \\     n(n-2)!!&&\mbox{if }n\ge2.\qquad\qquad    \end{matrix}   \right.

For example, 8!! = 2 · 4 · 6 · 8 = 384 and 9!! = 1 · 3 · 5 · 7 · 9 = 945. The sequence of double factorials (sequence A006882 in OEIS) for n = 0,1,2,... starts as

1, 1, 2, 3, 8, 15, 48, 105, 384, 945, 3840, ...

The above definition can be used to define double factorials of negative numbers:

(n-2)!!=\frac{n!!}{n}

The sequence of double factorials for n= -1, -3, -5, -7, \dots\, starts as

1, − 1,1 / 3, − 1 / 15...

while the double factorial of negative even integers is infinite.

Some identities involving double factorials are:

n!=n!!(n-1)!! \,
(2n)!!=2^nn! \,
(2n+1)!!={(2n+1)!\over(2n)!!}={(2n+1)!\over2^nn!}
\Gamma\left(n+{1\over2}\right)=\sqrt{\pi}\,\,{(2n-1)!!\over2^n}
\Gamma\left({n\over2}+1\right)=\sqrt{\pi}\,\,{n!!\over2^{(n+1)/2}}

where Γ() is the Gamma function. The last equation above may be used to define the double factorial as a function of any complex number n, just as the Gamma function generalizes the factorial function. One should be careful not to interpret n!! as the factorial of n!, which would be written (n!)! and is a much larger number (for n > 2).

[edit] 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. The double factorial is the most commonly used variant, but one can similarly define the triple factorial (n!!!) and so on. In general, the kth factorial, denoted by n!(k), is defined recursively as

n!^{(k)}=   \left\{    \begin{matrix}     1,\qquad\qquad\ &&\mbox{if }0\le n<k;    \\     n(n-k)!^{(k)},&&\mbox{if }n\ge k.\quad\ \ \,    \end{matrix}   \right.

Some mathematicians have suggested an alternative notation of n!2 for the double factorial and similarly n!k for other multifactorials, but this has not come into general use.

[edit] Quadruple factorial

The quadruple factorial, however, is not a multifactorial; it is a much larger number given by \frac{(2n)!}{n!}.

[edit] 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{sf}(4)=1! \times 2! \times 3! \times 4!=288 \,

In general

\mathrm{sf}(n)   =\prod_{k=1}^n k! =\prod_{k=1}^n k^{n-k+1}   =1^n\cdot2^{n-1}\cdot3^{n-2}\cdots(n-1)^2\cdot n^1.

The sequence of superfactorials starts (from n = 0) as

1, 1, 2, 12, 288, 34560, 24883200, ... (sequence A000178 in OEIS)

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 A055462 in OEIS)

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.

\mathrm{mf}(n,m) = \mathrm{mf}(n-1,m)\mathrm{mf}(n,m-1)   =\prod_{k=1}^n k^{n-k+m-1 \choose n-k}

where mf(n,0) = n for n > 0 and mf(0,m) = 1.

[edit] Superfactorials (alternative definition)

Clifford Pickover in his 1995 book Keys to Infinity defined the superfactorial of n as

n\mathrm{S}\!\!\!\!\!\;\,{!}\equiv \begin{matrix} \underbrace{ n!^{{n!}^{{\cdot}^{{\cdot}^{{\cdot}^{n!}}}}}} \\ n! \end{matrix}, \,

or as,

n\mathrm{S}\!\!\!\!\!\;\,{!}=n!^{(4)}n! \,

where the (4) notation denotes the hyper4 operator, or using Knuth's up-arrow notation,

n\mathrm{S}\!\!\!\!\!\;\,{!}=(n!)\uparrow\uparrow(n!) \,

This sequence of superfactorials starts:

1\mathrm{S}\!\!\!\!\!\;\,{!}=1 \,
2\mathrm{S}\!\!\!\!\!\;\,{!}=2^2=4 \,
3\mathrm{S}\!\!\!\!\!\;\,{!}=6\uparrow\uparrow6=6^{6^{6^{6^{6^6}}}}

[edit] Hyperfactorials

Main article: Hyperfactorial

Occasionally the hyperfactorial of n is considered. It is written as H(n) and defined by

H(n)   =\prod_{k=1}^n k^k   =1^1\cdot2^2\cdot3^3\cdots(n-1)^{n-1}\cdot n^n.

For n = 1,2,3,4,... the values of H(n) are 1, 4, 108, 27648,... (sequence A002109 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.

[edit] See also

[edit] References

  1. ^ Peter Borwein. "On the Complexity of Calculating Factorials". Journal of Algorithms 6, 376-380 (1985)
  2. ^ Peter Luschny. The Homepage of Factorial Algorithms.

[edit] External links

Factorial calculators
Factorial lists
Static Wikipedia 2008 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -

Static Wikipedia 2007 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -

Static Wikipedia 2006 (no images)

aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu