函数组合 #

计算从 n 种可能性中选择 k 种无序结果的方法数。

组合仅接受整数参数。必须强制执行以下条件:k <= n。

Syntax #

math.combinations(n, k)

Parameters #

Parameter Type Description
n number | BigNumber 集合中对象的总数
k number | BigNumber 子集中对象的数量

Returns #

Type Description
number | BigNumber 可能的组合数。

Throws #

Type | Description —- | ———–

Examples #

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

另请参阅 #

combinationsWithRep, permutations, factorial

Fork me on GitHub