How to find the number of combinations of a certain set that equals a certain number? How do I find out how many different combinations of this set {-1,-2,-3,-4,1,2,3,4} add up to equal 20? The combinations can have repeating numbers ex. one set can be {1,1,1,1,1,-2,3,1}. The size the set is restricted to 8. Thanks! 
 A: A simple observation shows that at least 5 of the numbers have to be positive in the combination of 8 numbers, for the sum to have any chance of getting to 20. Now, we can deal this in cases: 
Case I:
If exactly five of them are positive integers, then it isn't possible because after putting five 4s and summing upto 20, we can't sum rest of the three negative integers to 0. 
Case II:
If exactly six of them are positive integers, then 2 of them are negative integers. Well out of given negative integers, sum of 2 negative integers can either be -2, -3, -4, -5, -6, -7 and -8. 
This means that six of our positive integers can sum up to either 22, 23, 24, 25, 26, 27 and 28. So, we have to find the number of ways in which these numbers can be written, using only 1,2,3 or 4, and only six times. So, only 22,23 and 24 are possible in this way. 
24 can be expressed as a sum of 1,2,3 and 4 in only one way: 4+4+4+4+4+4 = 24.
23 can be expressed only one way : 3+4+4+4+4+4 = 23 
22 can be expressed in two ways : 4+4+4+4+4+2 = 22 = 4+4+4+4+3+3
So in this 2nd case, we have altogether 4 ways of doing it. 
Case III:
If exactly seven of them are positive integers, then only negative remaining number can be -1,-2,-3 or -4. In this case,seven of them must sum to 21,22,23 and 24. 
7 positive numbers can sum up to 21 in two ways: either have seven 3s or have five 3s, one 2 and one 4. 
Now you have to find in how many ways can seven numbers from {1,2,3,4} sum up to 22,23 or 24. 
Case IV
Now, you can have all 8 numbers positive, in which case you need to determine, how many ways can we write 20 as sum of 8 positive numbers from {1,2,3,4}. This can be determined (rather painstakingly) using the fact that we need at least  
