Factorial

The factorial is a function applied to whole numbers, defined as $$n! = \prod^n_{i = 1} i = n \cdot (n - 1) \cdot \ldots \cdot 4 \cdot 3 \cdot 2$$. Its most common usage is in determining the number of permutations n distinct objects can be arranged, because there are n ways to arrange the first object, $$n - 1$$ ways to arrange the second object (as the first spot has been taken), and so forth.

For example,

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

The special case $$0! = 1$$ has been set by definition as there is one way to arrange zero objects.

It can be defined recursively as $$0! = 1$$ and $$n! = n \cdot (n - 1)!$$.

The first few values of $$n!$$ for $$n = 0$$, 1, 2, 3, 4, ... are 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, and 39916800.

The sum of the reciprocals of the factorials, $$\sum^{\infty}_{i = 0} i! = \frac{1}{0!} + \frac{1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \ldots$$, approaches e, the mathematical constant.

Because $$n! = \Gamma (n + 1)$$ (where $$\Gamma (x)$$ is the gamma function), $$n! = \int^{\infty}_0 e^{-t} \cdot t^{n + 1} dt$$. This identity gives us factorials of positive real numbers, not limited to integers:


 * $$\left(\frac{1}{2}\right)! = \frac{\sqrt{\pi}}{2}$$
 * $$\left(-\frac{1}{2}\right)! = \sqrt{\pi}$$

Variation
Aalbert Torsius defines a variation on the factorial, where $$x!n = \prod^{x}_{i = 1} i!(n - 1) = 1!(n - 1) \cdot 2!(n - 1) \cdot \ldots \cdot x!(n - 1)$$ and $$x!0 = x$$.

$$x!n$$ is pronounced "nth level factorial of x."

The special case $$x!x$$ is a function known as the Torian.