CombinatoricFactorial Method |
Namespace: Kaos.Combinatorics
public static long Factorial( int value )
Exception | Condition |
---|---|
IndexOutOfRangeException | When value not in range (0..20). |
The number of rows in a Permutation table of n choices is:
Combinatoric.Factorial (n)
The number of rows in a Permutation table of k picks
from n choices is:
Combinatoric.Factorial (n) / Combinatoric.Factorial (n-k)
An exception to the above formulas is the special case where the number of elements in the permutation is 0. While mathematics treats this result as 1 row containing the empty product, this library returns 0 rows.