Factorial of n or n! mainly represents different ways to arrange n items. For example, 3 items ABC can be arranged 3! = 3 x 2 x 1 = 6 ways. The ways are ABC, ACB, BAC, BCA. CAB and CBA
Factorial for a positive integer n is defined as 1 x 2 x .... x (n-1) x n.
- Factorial is part of the permutation formula, nPr = (n! / (n - r)!) and combination formula nCr = (n! /(r! x (n - r)!))
- Factorials are part of power series of the exponent function. ex = 1 + x + x2/2! + x3/3! + ....
- If we add reciprocals of all factorials from 0 to infinity, we get e. In other words Sum(1/k!) where k goes from 0 to infinity is e. We can conclude this fact from the above ex series with x = 1.
- 70! is the smallest factorial which is greater than googol (10100). Note that 69! has 99 digits.
- Since Factorials are present in the formula of Binomial Coefficients, they are used in algebra. (x + y)n = Sum(nCk x n-k yk) for k = 0 to n, Binomial Distribution (probability of k successes in n binary outcome results where probability of success is p in every event is nCk (1 - P)n-k pk)
- Factorials are defined only for positive integers and 0.
- The last digit is always 0 for factorials of numbers greater than or equal to 5 because there will be 2 and a 5 in the factorial once we cross 5.
- All factorial values even for numbers greater than 1 because there will be a 2 in factorial.
- The number of trailing 0s in a factorial can be computed by counting 5 in the factorial. And number of 5s would be floor(n/5) + floor(n/25) + floor(n/125) + … 0
- If we wish to find the last non-zero digit in factorial, then it has the following interesting property
Let D(n) be the last non-zero digit in n!
If tens digit (or second last digit) of n is odd
D(n) = 4 * D(floor(n/5)) * D(Unit digit of n)
If tens digit (or second last digit) of n is even
D(n) = 6 * D(floor(n/5)) * D(Unit digit of n) - With the Sterlin's Formula, we find an upper bound on growth of Log (n!) as n Log n
- Factorial grow faster than an for for n tends to infinity. Please note that every term is fixed in a x a x a.... but in 1 x 2 x 3 x .... after crossing a, every term gets bigger in factorial n.
- Catalan Numbers appear in a lot of real world problems. For example. it is the count of valid expressions with n pairs of brackets. For example, if n = 2, then there are two valid expressions ()() and (()). The value of the n-th Catalan can be written in the form of factorials as (2n)! / [(n + 1) ! x n!]