A weak composition of a nonnegative integer is an ordered tuple of nonnegative
integers whose sum is
. It differs from a composition,
whose parts must be positive. For example,
and
are distinct weak compositions of 3 (Tesler 2019).
For a positive integer , the number of weak compositions of
into
parts is
To count them, arrange
stars and
separators in a row. The numbers of stars before, between, and after the separators
are the ordered parts. Choosing the separator positions gives the binomial
coefficient above. For
, there is one weak composition of each positive length,
consisting entirely of zeros. There is also one empty weak composition of 0 (Tesler
2019).