Binomial( n, k )
{n choose k} is the number of combinations with k elements, i.e.,
the number of subsets with k elements, of a set with n elements.
{n choose k} is the coefficient of the term x^k of the polynomial
(x + 1)^n, which is the generating function for {n choose *}, hence
the name.
Binomial
returns the binomial coefficient {n choose k} of integers
n and k, which is defined as n! / (k! (n-k)!) (see Factorial).
We define {0 choose 0} = 1, {n choose k} = 0 if k<0 or n gap> List( [0..4], k->Binomial( 4, k ) );
[ 1, 4, 6, 4, 1 ] # Knuth calls this the trademark of Binomial
gap> List( [0..6], n->List( [0..6], k->Binomial( n, k ) ) );;
gap> PrintArray( last );
[ [ 1, 0, 0, 0, 0, 0, 0 ], # the lower triangle is
[ 1, 1, 0, 0, 0, 0, 0 ], # called Pascal\'s triangle
[ 1, 2, 1, 0, 0, 0, 0 ],
[ 1, 3, 3, 1, 0, 0, 0 ],
[ 1, 4, 6, 4, 1, 0, 0 ],
[ 1, 5, 10, 10, 5, 1, 0 ],
[ 1, 6, 15, 20, 15, 6, 1 ] ]
gap> Binomial( 50, 10 );
10272278170
NrCombinations
(see Combinations) is the generalization of Binomial
for multisets. Combinations
(see Combinations) computes the set of
all combinations of a multiset.
April 1997