Function combinationsWithRep #

计算从 n 种可能性中选择 k 个无序结果的方式数量,允许单个结果重复多次。

CombinationsWithRep 只接受整数参数。必须强制执行以下条件:k <= n + k -1。

Syntax #

math.combinationsWithRep(n, k)

Parameters #

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

Returns #

Type Description
number | BigNumber 允许重复的组合数。

Throws #

Type | Description —- | ———–

Examples #

math.combinationsWithRep(7, 5) // returns 462

另请参阅 #

combinations, permutations, factorial

Fork me on GitHub