NCHOOSEK

Purpose:

Computes the binomial coefficient or returns all the unordered combinations of the elements of the input series.

Syntax:

NCHOOSEK(n, k)

n

-

A scalar or series. For a scalar, the binomial coefficient is returned. For a series and positive integer k, all the unordered combinations of the series elements of n are returned.

k

-

A scalar or series. If n is a series, and k a positive integer where 0 <= k <= length(n), all the unordered combinations of the series elements of n are returned.

Returns:

A scalar or series, the number of combinations of n items taken in unordered groups of k, or if n is a series and k a positive integer, the actual unordered combinations of the series elements where each row represents a group of k elements.

Example:

nchoosek(5, 3)

 

returns 10.

Example:

c = nchoosek(1..5, 3)

 

c == {{1, 2, 3},

      {1, 2, 4},

      {1, 2, 5},

      {1, 3, 4},

      {1, 3, 5},

      {1, 4, 5},

      {2, 3, 4},

      {2, 3, 5},

      {2, 4, 5},

      {3, 4, 5}}

Example:

nchoosek(5.3, 3)

 

returns 12.5345.

Example:

c = nchoosek(3..5, 1..3)

 

c == {3, 6, 10} == {nchoosek(3, 1), nchoosek(4, 2), nchoosek(5, 3)}

Remarks:

To return the actual combinations,  n must be a series and k must be an integer where 0 <= k <= length(n).

 

For scalar inputs, n and k can be any value.

 

For integer values where 0 <= k <= n:

 

 

 

See BINCOEFF to return the generalized binomial coefficient for any scalar or series inputs.

See Also:

BINCOEFF

FACTORIAL

GRANDBINOMIAL

PASCAL