function Binomial(N: Integer; K: Integer): Double;
Binomial coefficient C(n,k).
| # | Name | Description |
|---|---|---|
| 1 | N | n in nCk |
| 2 | integer. | |
| 3 | K | k in nCk |
| 4 | integer. |
Returns: Double - the binomial coefficient nCk.
Remarks:
Binomial coefficient nCk is the number of ways of picking k unordered outcomes from n possibilities, also known as a combination or combinatorial number. It is defined by:
binomnk = n!/(k! (n-k)!) .
Domain: N, K integer. Defined behavior: returns 0 when K < 0; returns 1 when K = 0 or K = N; returns N when K = 1 or K = N-1; otherwise the value is computed by the multiplicative product and rounded to the nearest integer. The result is returned as a double (it can exceed the 64-bit integer range for large N).