// In mathematics, the binomial coefficient C(n, k)
// is the number of ways of picking ‘k’ unordered outcomes
// from ‘n’ possibilities. It is given by the formula:
// C (n, k) = n! / k! (n − k)!
// run the following test. .
// bigint is not considered a basic type; it is an abbreviation for System.Numerics.BigInteger.
// TEST
// C 20 5
// Result: 15504
let C (n:int) (k:int) =
let N = bigint(n)
let K = bigint(k)
return fac N / fac K * fac N-K
let rec fac n =
match n with
| 0 | 1 -> 1
| _ -> n * fac(n-1)