0

Let $x_1,\dots,x_m$ be non-negative integers such that $\sum_{i=1}^m x_i=n$, where $m,n$ are given. How can I enumerate all such lists of $m$ integers that add to $n$?

Note that IntegerPartitions[n,{m}] counts two such lists as one if they are a permutation of each other, but I would count them as distinct.

Thus the list I want must have $\binom{m+n-1}{m-1}$ elements.

a06e
  • 11,327
  • 4
  • 48
  • 108

0 Answers0