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 ways n 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.

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.