How to find combinations of certain numbers that total 42

frogmo

New member
Joined
Apr 18, 2006
Messages
1
Is there a way to determine all combinations of two or more of the following numbers that add up to 42? The numbers are: 5 6 10 12 15 20 25 30

Thanks!!
 
If you assume that each number is used only once in a given sum, you can easily generate them. Start at the top, for example, 30+12=42.
 
Thanks, but I am not assuming that each number is used only once.
 
You've 8 values, the least of which is 5. This limits your usage to a maximum of 8.
You've 8 values, the greatest of which is 30. This limits your usage to a minimum 2.


Any using exactly 2 values? Yes. Try all 64 variations and see what works. You can eliminate many without actually performing the arithmetic.

Any using exactly 3 values? etc.

It's not magic. You have to do a little hunting.
 
Anonymous said:
Thanks, but I am not assuming that each number is used only once.
so you're saying 6+6+6+6+6+6+6 = 42 is a solution?
 
Top