combinat::composition
--
k-composition of an integercombinat::composition
computes a list of all distinct
ordered k-tupels (k_1, ..., k_n) such that
n_1 + ... + n_k = n and n_i >= 1, i=1..k.
combinat::composition(n,k)
n, k |
- | integer |
A list of type DOM_LIST
containing every computed
k-tupel also as a list of type DOM_LIST
. If there exist no
k-tupel the empty list is returned.
combinat::composition
(n, k)
returns an
empty list if n<1 or k<1 or
n<k.How can one write 5 as a sum of two other positive integers?
>> combinat::composition(5,2)
[[1, 4], [2, 3], [3, 2], [4, 1]]
There is no way to write 2 as the sum of 5 positive integers.
>> combinat::composition(2,5)
[]
combinat::composition
does not handle
symbolic expressions.
>> combinat::composition(xx,2)
Error: arguments must be integers [combinat::composition]