Navigation

Operators and Keywords

Function List:

C++ API

: bincoeff (n, k)

Return the binomial coefficient of n and k, defined as

 /   \
 |n |   n (n-1) (n-2) … (n-k+1)
 |  | = -------------------------
 |k |              k!
 \   /

For example:

bincoeff (5, 2)
   ⇒ 10

In most cases, the nchoosek function is faster for small scalar integer arguments. It also warns about loss of precision for big arguments.

See also: nchoosek.

Package: octave