函数 permutations #

计算从一个包含 n 个元素的集合中获取一个包含 k 个元素的有序子集的方法数。

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

Syntax #

math.permutations(n)
math.permutations(n, k)

Parameters #

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

Returns #

Type Description
number | BigNumber 排列数

Throws #

Type | Description —- | ———–

Examples #

math.permutations(5)     // 120
math.permutations(5, 3)  // 60

另请参阅 #

combinations, combinationsWithRep, factorial

Fork me on GitHub