DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


Declaration: BinomCoeff (n,k: integer): longint;

The function BinomCoeff calculates the binomial coefficient (n,k), which is the number of possible combinations when drawing k items out of a total set of n. The binomial coefficient is defined by the following formula:

The parameters n, and k have to be positive, with n >= k. If this condition is not fulfilled, BinomCoeff returns a zero value.

Please note that the binomial coefficient may become too large to be returned as longint value. In this case the function returns a value of -1. If you expect large binomial coefficients you maybe want to use the function LnBinomCoeff, which calculates the natural logarithm of it.