mathjs/docs/reference/functions/combinations.md
2014-05-18 22:21:00 +02:00

859 B

Function combinations

Compute the number of ways of picking k unordered outcomes from n possibilities.

Combinations only takes integer arguments. The following condition must be enforced: k <= n.

Syntax

math.combinations(n, k)

Parameters

Parameter Type Description
n Number | BigNumber Total number of objects in the set
k Number | BigNumber Number of objects in the subset

Returns

Type Description
Number | BigNumber Number of possible combinations.

Examples

var math = mathjs();

math.combinations(7, 5); // returns 21

See also

permutations, factorial