# Counting - Add 5 numbers in set k to sum to n

So, I've created a simple card game. Let's image a deck of cards with 3 suits with purely numeric values. A constraint being that there are only 12 cards opposed to 13 cards in each suit. I.e. there are three 1's, three 2's...three 12's for a total of 36 cards in the deck. Now, given a 5 card hand, how many different ways can I add up to n? For reference, the min hand would add up to n = 7 and the max hand would add up to n = 58. There are (36 choose 5) unique hands.

The ways to count the hands that add up to the minimum and maximum is 3

WLOG, n = 7. I can add up to 7 with (3 choose 3)*(3 choose 2) = 1*3 = 3 ways. This follows from the fact that I can pick all three 1's and then there are (3 choose 2) ways to pick the two of the three 2's in the deck.

Now, things start to get a little tough for the other numbers. n = 8 is do-able by hand but once we hit n = 9, I start to run into trouble. This is of course the motivation to using counting techniques!

For reference, here are the possible ways to add up to n = {7,8,9} with a 5 card hand given the possible hands...(I brute forced this in C)

Bin=3 Bin=12 Bin=39

I indeed have brute forced all the ways to add up to a given n but what's the fun in that? It would be great to use counting techniques to do this but I am not sure if this is a solvable problem using counting.

If this isn't solvable using counting, what other methods are available to solve this problem (if any)?

Thanks

• This smells like you need to use partitions, and, as you suspect, it is involved counting them. – John Nov 12 '14 at 21:05
• I will look into those. Thanks. Still open for other suggestions too ! – datKiDfromNY Nov 12 '14 at 22:29
• Update: This may indeed be an unsolved problem. – datKiDfromNY Nov 13 '14 at 2:12