This question already has an answer here:
- Find all permutations with a condition 3 answers
I need a function that creates a table of all possible lists of length $n$ which contain integer entries that sum up to the same given number $m$. For example, if we consider lists of size $n=3$ and want to distribute the number $m=2$ in them the result should be:
n=3; m=2; numberDistribute[n,m]
Is there such a function in Mathematica? Or maybe there is a convenient way to write it? Thanks for any suggestion.