mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
888 B
888 B
Function composition
Calculate the number of ways to split n into k nonempty parts.
Syntax
math.composition(n, k)
Parameters
| Parameter | Type | Description |
|---|---|---|
n |
Number | BigNumber | Total number of objects |
k |
Number | BigNumber | Number of objects in the subset |
Returns
| Type | Description |
|---|---|
| Number | BigNumber | The number of ways to split a set of n elements into k nonempty sets. |
Examples
math.composition(8, 3); // returns Number 21
math.composition(math.bignumber(70), math.bignumber(3)); // returns Number 2346