I want to write a function which gives me a combination of numbers (with the given number of them) as a coefficients, that sum of them gives us 4.
Let's say the given variable number is 2. So we need to say find combination of a+b=4
. It'll be [1,3], [2,2], [3,1], [0,4], [4,0]
. Or if the given variable number is 3, so need to find combination of a+b+c=4
which will be [1,2,1], [1,1,2]
, etc.
How can I do this?