Hello.
f[sum_, quant_] :=
Flatten[Permutations /@
IntegerPartitions[sum, {quant}, Range[0, sum]], 1]
t = {10, 20};
Table[Join[Table[{n - j}, {i, j + 1}],
Table[{t[[1]], t[[2]]}, {i, j + 1}]*
f[j, 2], {Total[Table[{t[[1]], t[[2]]}, {i, j + 1}]*f[j, 2], {2}]},
2], {j, 2, 2}]
I want to generate the matrix of all possoble outcomes. The problem is I cannot add forth column with the sum of rows of second and third columns. I guess this is because my total go with {20,30,40} at the time I need {{20},{30},{40}} After all I want to delete all columns inside a table which do not satisfy the candition using something like that
Select[Table..., #[[4]] <= t[[1]](3-j) + t[[2]]-n-j &]
Regards,
Alex