compositions(k, n)
|
|
To find all unordered compositions, we can use sort or rsort to put each composition into a standard form, then use the function unique to remove duplicates.
|
In the next example, we use select to find all the compositions of 18 into 5 parts, with each part greater than or equal to 3.
|
For partitions of n into unordered, strictly positive parts, use partitions instead.
If a negative integer is given for n, an empty list is returned. If a negative integer is given for k, it will cause an error.
The object compositions is a method function.
The source of this document is in Macaulay2Doc/functions/compositions-doc.m2:47:0.