I am trying to write a function has input:
given_num=6, n=3
How to return a result of all possible combinations as list with n elements and sum = given_num nested in a list:
[[0,0,6],[0,1,5],[0,2,4],[0,3,3],[0,4,2],[0,5,1],[0,6,0],
[1,0,5],[1,1,4],[1,2,3],[1,3,2],[1, 4,1],[1,5,0],
...
[6,0,0]]
solved, and the possible combination is calculated as
factorial(given_num+n-1)/(factorial(given_num) * factorial(n-1))