| MathHelperBinomialCoefficient Method |
Computes the binomial coefficient of (n, k), also read as "n choose k".
Namespace: DigitalRune.MathematicsAssembly: DigitalRune.Mathematics (in DigitalRune.Mathematics.dll) Version: 1.14.0.0 (1.14.0.14427)
Syntax public static long BinomialCoefficient(
int n,
int k
)
Public Shared Function BinomialCoefficient (
n As Integer,
k As Integer
) As Long
public:
static long long BinomialCoefficient(
int n,
int k
)
static member BinomialCoefficient :
n : int *
k : int -> int64
Parameters
- n
- Type: SystemInt32
n, must be a value equal to or greater than 0. - k
- Type: SystemInt32
k, a value in the range [0, n].
Return Value
Type:
Int64
The binomial coefficient.
Remarks
This method returns a binomial coefficient. The result is the k'th element in the n'th row
of Pascal's triangle (using zero-based indices for k and n). This method returns 0 for
negative n.
See Also