n | n ! |
---|---|
0 | 1 |
1 | 1 |
2 | 2 |
3 | 6 |
4 | 24 |
5 | 120 |
6 | 720 |
7 |
5 040 Reading: Factorial – Wikipedia |
8 |
40 320 |
9 |
362 880 |
10 |
3 628 800 |
11 |
39 916 800 |
12 |
479 001 600 |
13 |
6 227 020 800 |
14 |
87 178 291 200 |
15 |
1 307 674 368 000 |
16 |
20 922 789 888 000 |
17 |
355 687 428 096 000 |
18 |
6 402 373 705 728 000 |
19 |
121 645 100 408 832 000 |
20 |
2 432 902 008 176 640 000 |
25 |
1.551 121 004 × 1025 |
50 |
3.041 409 320 × 1064 |
70 |
1.197 857 167 × 10100 |
100 |
9.332 621 544 × 10157 |
450 |
1.733 368 733 × 101 000 |
1 000 |
4.023 872 601 × 102 567 |
3 249 |
6.412 337 688 × 1010 000 |
10 000 |
2.846 259 681 × 1035 659 |
25 206 |
1.205 703 438 × 10100 000 |
100 000 |
2.824 229 408 × 10456 573 |
205 023 |
2.503 898 932 × 101 000 004 |
1 000 000 |
8.263 931 688 × 105 565 708 |
10100 |
10
10101.998 109 775 Read more: Clint Barton (Marvel Cinematic Universe) 4820 |
In mathematics, the factorial of a non-negative integer newton, denoted by n !, is the merchandise of all convinced integers less than or adequate to n : n ! = n ⋅ ( nitrogen − 1 ) ⋅ ( nitrogen − 2 ) ⋅ ( normality − 3 ) ⋅ ⋯ ⋅ 3 ⋅ 2 ⋅ 1. { \displaystyle north ! =n\cdot ( n-1 ) \cdot ( n-2 ) \cdot ( n-3 ) \cdot \cdots \cdot 3\cdot 2\cdot 1\ ,. } 5 ! = 5 ⋅ 4 ⋅ 3 ⋅ 2 ⋅ 1 = 120. { \displaystyle 5 ! =5\cdot 4\cdot 3\cdot 2\cdot 1=120\ ,. } For exemplar, The value of 0 ! is 1, according to the conventionality for an empty intersection. [ 1 ] The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis. Its most basic consumption counts the potential distinct sequences – the permutations – of north discrete objects : there are n !. The factorial function can besides be extended to non-integer arguments while retaining its most important properties by defining x ! = Γ ( x + 1 ), where Γ is the da gamma function ; this is undefined when ten is a negative integer .
history [edit ]
The concept of factorials has arisen independently in many cultures :
From the former fifteenth hundred ahead, factorials became the subject of cogitation by western mathematicians. In a 1494 treatise, italian mathematician Luca Pacioli calculated factorials up to 11 !, in connection with a trouble of dining table arrangements. [ 10 ] Christopher Clavius discussed factorials in a 1603 comment on the work of Johannes de Sacrobosco, and in the 1640s, french polymath Marin Mersenne published bombastic ( but not wholly correct ) tables of factorials, up to 64 !, based on the function of Clavius. The power serial for the exponential function, with the reciprocals of factorials for its coefficients, was first formulated in 1676 by Isaac Newton in a letter to Gottfried Wilhelm Leibniz. [ 12 ] early crucial works of early european mathematics on factorials include extensive coverage in a 1685 treatise by John Wallis, a discipline of their approximate values for large values of n by Abraham de Moivre in 1721, a 1729 letter from James Stirling to de Moivre stating what became known as Stirling ‘s approximation, and study at the same clock by Daniel Bernoulli and Leonhard Euler formulating the continuous extension of the factorial serve to the da gamma affair. [ 13 ] Adrien-Marie Legendre included Legendre ‘s formula, describing the exponents in the factorization of factorials into prime powers, in an 1830 text on number theory. [ 14 ] The notation n ! for factorials was introduced by the french mathematician Christian Kramp in 1808. many other notations have besides been used. Another former note, in which the argument of the factorial was half-enclosed by the leave and penetrate sides of a box, was popular for some time in Britain and America but fell out of use, possibly because it is unmanageable to typeset. [ 15 ] The word “ factorial ” ( in the first place French, factorielle ) was first used in this sense in 1800 by Louis François Antoine Arbogast, in the beginning work on Faà di Bruno ‘s formula. [ 16 ] [ 17 ]
definition [edit ]
The factorial function of a positive integer newton { \displaystyle nitrogen } is defined by the product [ 1 ] normality ! = 1 ⋅ 2 ⋅ 3 ⋯ ( newton − 2 ) ⋅ ( normality − 1 ) ⋅ nitrogen, { \displaystyle nitrogen ! =1\cdot 2\cdot 3\cdots ( n-2 ) \cdot ( n-1 ) \cdot normality, }
normality ! = ∏ i = 1 nitrogen one. { \displaystyle n ! =\prod _ { i=1 } ^ { n } iodine. } This may be written more concisely in product notation as In this product recipe, all but the end term define a product of the lapp form, for a smaller factorial. This leads to a recurrence relation, according to which each value of the factorial function can be obtained by multiplying the former value by nitrogen { \displaystyle n } : [ 18 ] nitrogen ! = ( north − 1 ) ! ⋅ newton. { \displaystyle nitrogen ! = ( n-1 ) ! \cdot nitrogen. } 5 ! = 4 ! ⋅ 5 = 24 ⋅ 5 = 120 { \displaystyle 5 ! =4 ! \cdot 5=24\cdot 5=120 }
Factorial of zero [edit ]
For model, The factorial of 0 { \displaystyle 0 } is 1 { \displaystyle 1 } , or in symbols, 0 ! = 1 { \displaystyle 0 ! =1 } . There are respective motivations for this definition :
- For normality = 0 { \displaystyle n=0 } normality ! { \displaystyle n ! }empty product, a product of no factors, is equal to the multiplicative identity.[19]
- There is exactly one permutation of zero objects: with nothing to permute, the only rearrangement is to do nothing.[18]
- This convention makes many identities in combinatorics valid for all valid choices of their parameters. For instance, the number of ways to choose all nitrogen elements from a set of normality is ( normality newton ) = newton ! normality ! 0 ! = 1, { \textstyle { \tbinom { nitrogen } { nitrogen } } = { \tfrac { newton ! } { newton ! 0 ! } } =1, }binomial coefficient identity that would only be valid for 0 ! = 1.[20]
- With 0 ! = 1 { \displaystyle 0 ! =1 } nitrogen = 1 { \displaystyle n=1 }base case for recursive computation of the factorial without need for additional special cases.[21]
- Setting 0 ! = 1 { \displaystyle 0 ! =1 }exponential function, as a power series: vitamin e x = ∑ n = 0 ∞ x normality north !. { \textstyle e^ { ten } =\sum _ { n=0 } ^ { \infty } { \frac { x^ { n } } { nitrogen ! } }. }[12]
- This choice matches the gamma function 0 ! = Γ ( 0 + 1 ) = 1 { \displaystyle 0 ! =\Gamma ( 0+1 ) =1 }continuous.[22]
Applications [edit ]
The earliest uses of the factorial function involve counting permutations : there are n ! different ways of arranging n discrete objects into a sequence. [ 23 ] Factorials appear more broadly in many formulas in combinatorics, to account for different orderings of objects. For exemplify the binomial coefficients ( north thousand ) { \displaystyle { \tbinom { n } { k } } } count the thousand { \displaystyle thousand } -element combinations ( subsets of kilobyte { \displaystyle thousand } elements ) from a set with north { \displaystyle n } elements, and can be computed from factorials using the formula ( n k ) = normality ! kilobyte ! ( north − k ) !. { \displaystyle { \binom { newton } { k } } = { \frac { n ! } { thousand ! ( n-k ) ! } }. } nitrogen { \displaystyle n } newton ! / einsteinium { \displaystyle north ! /e } Another combinatorial application is in counting derangements, permutations that do not leave any element in its original side ; the number of derangements ofitems is the nearest integer to In algebra, the factorials arise through the binomial coefficients and the binomial theorem using this theorem to expand products of sums. They besides occur in the coefficients used to relate certain families of polynomials to each early, for exemplify in Newton ‘s identities for symmetrical polynomials. [ 27 ] Their use in counting permutations can besides be restated algebraically : the factorials are the orders of finite symmetrical groups. [ 28 ] In tartar, factorials occur in Faà di Bruno ‘s rule for chaining higher derivatives. [ 17 ] In mathematical analysis, factorials frequently appear in the denominators of power series, most notably in the series for the exponential officiate, [ 12 ] e x = 1 + x 1 + x 2 2 + x 3 6 + ⋯ = ∑ one = 0 ∞ x one one !, { \displaystyle e^ { adam } =1+ { \frac { x } { 1 } } + { \frac { x^ { 2 } } { 2 } } + { \frac { x^ { 3 } } { 6 } } +\cdots =\sum _ { i=0 } ^ { \infty } { \frac { x^ { i } } { i ! } }, } north ! { \displaystyle newton ! } nitrogen { \displaystyle newton } adam newton { \displaystyle x^ { nitrogen } } This usage of factorials in power series connects back to nitrogen i { \displaystyle n_ { i } } iodine { \displaystyle i } ∑ iodine = 0 ∞ adam i n one one !. { \displaystyle \sum _ { i=0 } ^ { \infty } { \frac { x^ { one } n_ { i } } { iodine ! } }. } and in the coefficients of other Taylor series, where they cancel factors ofcoming from theth derivative ofThis usage of factorials in baron series connects back to analytic combinatorics through the exponential generate function, which for a combinatorial course withelements of sizeis defined as the office series In number hypothesis, the most salient property of factorials is the divisibility of north ! { \displaystyle newton ! } by all positive integers up to n { \displaystyle newton }, described more precisely for prime factors by Legendre ‘s recipe. It follows that nitrogen ! ± 1 { \displaystyle north ! \pm 1 } has only large prime factors, leading to a proof of Euclid ‘s theorem that the count of primes is space. When normality ! ± 1 { \displaystyle normality ! \pm 1 } is itself premier it is called a factorial prime ; [ 31 ] relatedly, Brocard ‘s problem, besides posed by Srinivasa Ramanujan, concerns the being of square numbers of the shape n ! + 1 { \displaystyle newton ! +1 } . [ 32 ] In line, the numbers n ! + 2, north ! + 3, … n ! + newton { \displaystyle newton ! +2, n ! +3, \dots normality ! +n } must all be complex, proving the being of randomly large prime gaps. An elementary proof of Bertrand ‘s contend on the universe of a prime in any interval of the form [ n, 2 newton ] { \displaystyle [ n,2n ] } , one of the first results of Paul Erdős, was based on the divisibility properties of factorials. [ 33 ] Factorials can be used in a primality test based on Wilson ‘s theorem, which states that a number phosphorus { \displaystyle phosphorus } is flower if and only if ( p − 1 ) ! ≡ − 1 ( mod p ). { \displaystyle ( p-1 ) ! \equiv -1 { \pmod { phosphorus } }. }
Factorials are used in the factorial number organization, a mix base notation for numbers in which the plaza values of each digit are factorials. Factorials are used extensively in probability theory, for example in the Poisson distribution and in formulas for the probabilities of sequences of items where every permutation of the items is evenly probably. [ 35 ] In computer science, beyond appearing in the analysis of brute-force searches over permutations, [ 36 ] factorials arise in the lower tie of log 2 n ! { \displaystyle \log _ { 2 } normality ! } on the count of comparisons needed to comparison sort a dress of newton { \displaystyle north } items, [ 37 ] and in the psychoanalysis of chain hashish tables, where the distribution of keys per cell can be accurately approximated by a Poisson distribution. [ 38 ]
Properties [edit ]
pace of growth and approximation [edit ]
plot of the natural logarithm of the factorial As north grows, the factorial n ! increases faster than all polynomials and exponential functions ( but slower than newton north { \displaystyle n^ { newton } } and double exponential functions ) in newton. Most approximations for n ! are based on approximating its natural logarithm ln normality ! = ∑ x = 1 normality ln x. { \displaystyle \ln newton ! =\sum _ { x=1 } ^ { n } \ln x\ ,. } The graph of the officiate f ( n ) = ln n ! is shown in the figure on the right. It looks approximately linear for all reasonable values of normality, but this intuition is assumed. We get one of the simplest approximations for ln n ! by bounding the sum with an integral from above and below deoxyadenosine monophosphate follows : ∫ 1 nitrogen ln x d x ≤ ∑ x = 1 newton ln x ≤ ∫ 0 nitrogen ln ( x + 1 ) d x { \displaystyle \int _ { 1 } ^ { newton } \ln x\, dx\leq \sum _ { x=1 } ^ { nitrogen } \ln x\leq \int _ { 0 } ^ { north } \ln ( x+1 ) \, dx } normality ln ( normality e ) + 1 ≤ ln newton ! ≤ ( north + 1 ) ln ( normality + 1 einsteinium ) + 1. { \displaystyle n\ln \left ( { \frac { nitrogen } { e } } \right ) +1\leq \ln nitrogen ! \leq ( n+1 ) \ln \left ( { \frac { n+1 } { e } } \right ) +1\ ,. } which gives us the estimate Hence ln n ! ∼ n ln n ( see Big O notation ). This leave plays a key function in the analysis of the computational complexity of sorting algorithm ( see comparison classify ). From the bounds on ln n ! deduced above we get that ( newton east ) n e ≤ n ! ≤ ( n + 1 einsteinium ) n + 1 e. { \displaystyle \left ( { \frac { newton } { einsteinium } } \right ) ^ { nitrogen } e\leq north ! \leq \left ( { \frac { n+1 } { e } } \right ) ^ { n+1 } e\ ,. } It is sometimes practical to use weaker but simpler estimates. Using the above recipe it is easily shown that for all normality we have ( n /3 ) n < n !, and for all n ≥ 6 we have n ! < ( n /2 ) n .
Comparison of Stirling ‘s estimate with the factorial For large nitrogen we get a better estimate for the count n ! using Stirling ‘s approximation : north ! ∼ 2 π n ( north e ) nitrogen. { \displaystyle n ! \sim { \sqrt { 2\pi nitrogen } } \left ( { \frac { normality } { e } } \right ) ^ { newton } \ ,. } This in fact comes from an asymptotic series for the logarithm, and normality factorial lies between this and the following approximation : 2 π normality ( n east ) n < n ! < 2 π n ( north east ) n e 1 / ( 12 north ). { \displaystyle { \sqrt { 2\pi nitrogen } } \left ( { \frac { n } { e } } \right ) ^ { newton }
Another approximation for ln n! is given by Srinivasa Ramanujan:[39]
ln
n
!
≈
n
ln
n
−
n
+
ln
(
n
(
1
+
4
n
(
1
+
2
n
)
)
)
6
+
ln
π
2
⟹
n
!
≈
2
π
n
(
n
e
)
n
(
1
+
1
2
n
+
1
8
n
2
)
1
/
6
.
{\displaystyle {\begin{aligned}\ln n!&\approx n\ln n-n+{\frac {\ln {\Bigl (}n{\bigl (}1+4n(1+2n){\bigr )}{\Bigr )}}{6}}+{\frac {\ln \pi }{2}}\\[6px]\Longrightarrow \;n!&\approx {\sqrt {2\pi n}}\left({\frac {n}{e}}\right)^{n}\left(1+{\frac {1}{2n}}+{\frac {1}{8n^{2}}}\right)^{1/6}\,.\end{aligned}}}
Both this and Stirling’s approximation give a relative error on the order of 1/n3, but Ramanujan’s is about four times more accurate. However, if we use two correction terms in a Stirling-type approximation, as with Ramanujan’s approximation, the relative error will be of order 1/n5:[40]
n
!
≈
2
π
n
(
n
e
)
n
exp
(
1
12
n
−
1
360
n
3
)
.
{\displaystyle n!\approx {\sqrt {2\pi n}}\left({\frac {n}{e}}\right)^{n}\exp \left({{\frac {1}{12n}}-{\frac {1}{360n^{3}}}}\right)\,.}
Divisibility
[
edit
]
Legendre’s formula gives the multiplicity of the prime p occurring in the prime factorization of n! as
∑
i
=
1
∞
⌊
n
p
i
⌋
{\displaystyle \sum _{i=1}^{\infty }\left\lfloor {\frac {n}{p^{i}}}\right\rfloor }
n
−
s
p
(
n
)
p
−
1
,
{\displaystyle {\frac {n-s_{p}(n)}{p-1}},}
sp(n)
denotes the sum of the standard base-
p
digits of
n
.
or, equivalently,wheredenotes the sum of the standard base-digits of
The special case of this formula for
p
=
5
{\displaystyle p=5}
gives the number of trailing zeros in the decimal representation of the factorials.
The greatest common divisor of the values of a primitive polynomial over the integers must be a divisor of the factorial of the polynomial’s degree.[41]
Computation
[
edit
]
If efficiency is not a concern, computing factorials is trivial from an algorithmic point of view: successively multiplying a variable initialized to 1 by the integers up to n (if any) will compute n!, provided the result fits in the variable. In functional languages, the recursive definition is often implemented directly to illustrate recursive functions.
The main practical difficulty in computing factorials is the size of the result. To assure that the exact result will fit for all legal values of even the smallest commonly used integral type (8-bit signed integers) would require more than 700 bits, so no reasonable specification of a factorial function using fixed-size types can avoid questions of overflow. The values 12! and 20! are the largest factorials that can be stored in, respectively, the 32-bit and 64-bit integers commonly used in personal computers, however many languages support variable length integer types capable of calculating very large values.[42] Floating-point representation of an approximated result allows going a bit further, but this also remains quite limited by possible overflow. Most calculators use scientific notation with 2-digit decimal exponents, and the largest factorial that fits is then 69!, because 69! < 10100 < 70!. Other implementations (such as computer software such as spreadsheet programs) can often handle larger values.
Most software applications will compute small factorials by direct multiplication or table lookup. Larger factorial values can be approximated using Stirling’s formula. Wolfram Alpha can calculate exact results for the ceiling function and floor function applied to the binary, natural and common logarithm of n! for values of n up to 249999, and up to 20000000! for the integers.
If the exact values of large factorials are needed, they can be computed using arbitrary-precision arithmetic. Instead of doing the sequential multiplications ((1 × 2) × 3) × 4…, a program can partition the sequence into two parts, whose products are roughly the same size, and multiply them using a divide-and-conquer method. This is often more efficient.[43]
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).[44] Peter Luschny presents source code and benchmarks for several efficient factorial algorithms, with or without the use of a prime sieve.[45]
As an integer sequence
[
edit
]
Although the infinite sum of reciprocals of factorials adds to the irrational number
e
{\displaystyle e}
,
∑
n
=
0
∞
1
n
!
=
1
1
+
1
1
+
1
2
+
1
6
+
1
24
+
1
120
+
⋯
=
e
{\displaystyle \sum _{n=0}^{\infty }{\frac {1}{n!}}={\frac {1}{1}}+{\frac {1}{1}}+{\frac {1}{2}}+{\frac {1}{6}}+{\frac {1}{24}}+{\frac {1}{120}}+\cdots =e\,}
∑
n
=
0
∞
1
(
n
+
2
)
n
!
=
1
2
+
1
3
+
1
8
+
1
30
+
1
144
+
⋯
=
1
.
{\displaystyle \sum _{n=0}^{\infty }{\frac {1}{(n+2)n!}}={\frac {1}{2}}+{\frac {1}{3}}+{\frac {1}{8}}+{\frac {1}{30}}+{\frac {1}{144}}+\cdots =1\,.}
k
!
−
1
k
!
{\displaystyle {\frac {k!-1}{k!}}}
Generalization to of non-integer values
[
edit
]
The gamma function interpolates the factorial function to non-integer values. The main clue is the recurrence relation generalized to a continuous domain.
it is possible to multiply the factorials by positive integers to produce a convergent series with a rational sum:The convergence of this series to 1 can be seen from the fact that its partial sums are. Therefore, the factorials do not form an irrationality sequence
Besides nonnegative integers, the factorial can also be defined for non-integer values, but this requires more advanced tools from mathematical analysis.
One function that fills in the values of the factorial (but with a shift of 1 in the argument), that is often used, is called the gamma function, denoted Γ(z). It is defined for all complex numbers z except for the non-positive integers, and given when the real part of z is positive by
Γ
(
z
)
=
∫
0
∞
t
z
−
1
e
−
t
d
t
.
{\displaystyle \Gamma (z)=\int _{0}^{\infty }t^{z-1}e^{-t}\,dt.}
n! = Γ(n + 1)
for every nonnegative integer
n
.
Its relation to the factorial is thatfor every nonnegative integer
The gamma function is certainly not the only way to extend factorials to a function defined at almost all complex values, and not even the only one that is analytic wherever it is defined. Nonetheless it is usually considered the most natural way to extend the values of the factorials to a complex function. For instance, the Bohr–Mollerup theorem states that the gamma function is the only function that takes the value 1 at 1, satisfies the functional equation Γ(n + 1) = nΓ(n), is meromorphic on the complex numbers, and is log-convex on the positive real axis.
Other complex functions that interpolate the factorial values include Hadamard’s gamma function which, unlike the gamma function, is an entire function.[47][48]
Approximations
[
edit
]
For the large values of the argument, the factorial can be approximated through the logarithm of the gamma function, using a continued fraction representation. This approach is due to T. J. Stieltjes (1894).[49] Writing
ln
Γ
(
z
)
=
p
(
z
)
+
ln
2
π
2
−
z
+
(
z
+
1
2
)
ln
(
z
)
,
{\displaystyle \ln \Gamma (z)=p(z)+{\frac {\ln 2\pi }{2}}-z+\left(z+{\frac {1}{2}}\right)\ln(z)\,,}
p
(
z
)
{\displaystyle p(z)}
p
(
z
)
=
a
0
z
+
a
1
z
+
a
2
z
+
a
3
z
+
⋱
{\displaystyle p(z)={\cfrac {a_{0}}{z+{\cfrac {a_{1}}{z+{\cfrac {a_{2}}{z+{\cfrac {a_{3}}{z+\ddots }}}}}}}}}
a
n
{\displaystyle a_{n}}
-
n
an
0 1
/
12
1 1
/
30
2 53
/
210
3 195
/
371
4 22
999
/
22
737
5 29
944
523
/
19
733
142
6 109
535
241
009
/
48
264
275
462
Stieltjes gave a continued fraction forThe first few coefficientsare
The continued fraction converges iff
ℜ
(
z
)
>
0
{\displaystyle \Re (z)>0}
2}” class=”mwe-math-fallback-image-inline” src=”https://wikimedia.org/api/rest_v1/media/math/render/svg/957a574c858d5f8146ef6b79e13a2b0a57b9c39b”/>, the six coefficients above are sufficient for the evaluation of the factorial with complex double precision. For higher precision more coefficients can be computed by a rational QD scheme (Rutishauser’s QD algorithm).[51]
Non-extendability to negative integers
[
edit
]
The relation n! = n × (n − 1)! allows one to compute the factorial for an integer given the factorial for a smaller integer. The relation can be inverted so that one can compute the factorial for an integer given the factorial for a larger integer:
(
n
−
1
)
!
=
n
!
n
.
{\displaystyle (n-1)!={\frac {n!}{n}}.}
However, this recursion does not permit us to compute the factorial of a negative integer; use of the formula to compute (−1)! would require a division of a nonzero value by zero, and thus blocks us from computing a factorial value for every negative integer. Similarly, the gamma function is not defined for zero or negative integers, though it is defined for all other complex numbers.
Related sequences and functions
[
edit
]
Several other integer sequences are similar to or related to the factorials:
See also
[
edit
]
References
[
edit
]
Read more: Willem Dafoe