Skip to content

pactole-js


Function: comb()

comb(n, k): number

Defined in: combinations/rank.ts:34

Cached computation of the binomial coefficient (n choose k).

Parameters

n

number

The total number of items.

k

number

The number of items to choose.

Returns

number

The number of combinations (n choose k).

Throws

Thrown when n or k is negative or not an integer.

Examples

`comb(5, 2) // 10`
`comb(10, 3) // 120`