I want to find an efficient way for computer to handle LARGE NUMBER OF VARIABLES (say 50: x1, ... , x50) that do something like this: find ALL combinations [x1,x2,x3] satisfying:
0 <= x1 <= x2 <= x3
x1 + x2 + x3 = 100
Here is an example of finding all combinations with sum = 100 but [1,99] and [99,1] are considered to be different here:
x=[]
for i, j in itertools.product(range(0,101), range(0,101)):
if i+j==100:
x.append([i,j])
I want to find a way to reduce the number of loops and give only things like:
[0,100], [1,99], [2,98], .........., [50,50]
And nothing from [51,49].
The main goal is doing this with 50 variables (x_1,...x_50) which sums up to 100.
It is not likely to do it with normal loop