1 |
|
2 |
|
3 | # Function permutations
|
4 |
|
5 | Compute the number of ways of obtaining an ordered subset of `k` elements
|
6 | from a set of `n` elements.
|
7 |
|
8 | Permutations only takes integer arguments.
|
9 | The following condition must be enforced: k <= n.
|
10 |
|
11 |
|
12 | ## Syntax
|
13 |
|
14 | ```js
|
15 | math.permutations(n)
|
16 | math.permutations(n, k)
|
17 | ```
|
18 |
|
19 | ### Parameters
|
20 |
|
21 | Parameter | Type | Description
|
22 | --------- | ---- | -----------
|
23 | `n` | number | BigNumber | The number of objects in total
|
24 | `k` | number | BigNumber | The number of objects in the subset
|
25 |
|
26 | ### Returns
|
27 |
|
28 | Type | Description
|
29 | ---- | -----------
|
30 | number | BigNumber | The number of permutations
|
31 |
|
32 |
|
33 | ## Examples
|
34 |
|
35 | ```js
|
36 | math.permutations(5) // 120
|
37 | math.permutations(5, 3) // 60
|
38 | ```
|
39 |
|
40 |
|
41 | ## See also
|
42 |
|
43 | [combinations](combinations.md),
|
44 | [combinationsWithRep](combinationsWithRep.md),
|
45 | [factorial](factorial.md)
|
46 |
|
\ | No newline at end of file |