I want to have all the distinct absolute sums of x combinations of (-1,1) and y combinations of (-2,2).
Let's say I sum 3 combinations of (-1,1) and 2 combinations of (-2,2)/
Intuitively, the distinct, absolute, results should be 7, 5, 3, 1 :
1+1+1+2+2=7
1+1-1+2+2=5
1-1-1+2+2=3
-1-1-1+2+2=1
I'm having a hard time finding a mathematical representation of this problem, and also an algorithm to best find the distinct results without calculating all the $2^(x+y)$ possible sums.