**This is an old revision of the document!**

If you want to calculate a factorial use the iterative algorithm. The recursive algorithm is included because factorial highlights the differences between iterating and recursing nicely.

$$n!=\prod_{k=1}^n k \!$$

$$ n! = \begin{cases} 1 & \text{if } n = 0, \\ (n-1)!\times n & \text{if } n > 0. \end{cases} $$

factorial.1349415507.txt.gz · Last modified: 2015/02/02 08:24 (external edit)