Factorial Algorithm

In mathematics, the factorial of a positive integer N, denoted by N !, is the merchandise of all positive integers less than or equal to N. The factorial operation is encountered in many areas of mathematics, notably in combinatorics, algebra, and mathematical analysis. In 1677, Fabian Stedman described factorials as apply to change ringing, a musical art involve the ringing of many tuned Bell. 

Factorials were used to count permutations at least as early as the 12th century, by Indian scholars. insomuch that a compleat Peal of changes on one number seemeth to be formed by unite of the compleat Peals on all lesser numbers into one entire body.

Factorial source code, pseudocode and analysis