21Flip
21Flip
  • Threads: 17
  • Posts: 94
Joined: Dec 22, 2014
January 1st, 2015 at 10:07:59 PM permalink
I want to solve for Sum (S) using only a specific amount (N) of whole number integers, and I want to know the number of combinations (C) achieving said Sum (S). However, there is a specific pool of integers available, and in specific quantities.

So: S = 17, N = 5

The real world example is 6 decks, and I want to know the number of ways to reach the total of 17 (S) by drawing exactly 5 (N) cards.


Please, if you would, explain the process to find this answer, and not provide the answer itself.

I want to learn the HOW of doing this.


I do understand that the answer comes after getting the permutation of 312!/307!, which tells me all the possible permutations of drawing out 5 cards from a 6 deck shoe. I further understand that I can reduce this by 5!, because I don't care about the ORDER that the cards are in, which gives me all the possible combinations of drawing five cards from a six deck shoe - 23,474,070,697.

Where I am getting hung up is knowing how to discover all the combinations of 5 cards that equal 17. I mean, I know that 5, 2, 2, 3, 5 is one, but there have to be millions - surely there is a mathematical formula to discover this?

How do I transition from just knowing all the combinations of the cards, to assigning VALUES to each of those cards within those combinations?

Any hints, tips, or clues?
21Flip
21Flip
  • Threads: 17
  • Posts: 94
Joined: Dec 22, 2014
January 1st, 2015 at 11:29:42 PM permalink
Ok, in thinking about this, I think I know one way to solve - find all ways to make 17 from 2 numbers that are values of playing cards, with A equal to one.

So, 10-7, 9-8.

Now, find all the ways to make each of those numbers from 2 numbers - for 10, you have 9-1, 8-2, etc.

Keep "forking" until you get down to every possibility of cards that add up to 17.

Then, figure out how many of those use 5 cards, or "forks", to equal 17.

So, 10, 2-3, and A-A equals 17, and has 5 cards...

Its using the parts of parts to get there... you hust need to figure out a way to identify the 17s that use only 5 parts, no more or less.
PeeMcGee
PeeMcGee
  • Threads: 1
  • Posts: 115
Joined: Jul 23, 2014
January 2nd, 2015 at 6:58:43 PM permalink
I think brute’ish force might be the best way to go for this particular problem.

So if you start with a 10, the next highest card must be a 4, and the other three are 1 (or aces). Then, the next combination would be [10,3,2,1,1]. And so on. You’ll find there are 43 of these combinations (so it wouldn’t be too difficult to do this by hand—but I did use a computer).

Then, count the number of ways to do each combination. So for [10,4,1,1,1] you are choosing one 10 out of 96, one 4 out of 24, and three 1s out of 24. Writing it in math…
Combin(96,1)*combin(24,1)*combin(24,3) = 4,663,296

Once you have all the number of ways for each of the 43 combinations…sum them all up. Again, a computer makes finding and summing this very simple (but doable by hand).

The total number of 5-card combinations with sum 17 is
127,953,648

By the way, I’m getting 23,856,384,552 total combinations. This is combin(312,5).

So then the probability to get a 5-card combination with sum 17 is then
0.00536 or about 1 in 186
AceTwo
AceTwo
  • Threads: 5
  • Posts: 359
Joined: Mar 13, 2012
January 5th, 2015 at 1:22:19 PM permalink
What PeeMcGee said and also note.
You can use Excel to find the 43 combinations and have them in a table format (rows for each combination and 5 columns for the 5 numbers)
Then instead of finding for each row the formula like Combin(96,1)*combin(24,1)*combin(24,3) you can use excel functions to Develop a single formula (or several formulas) for one row to be copied down to each row.
The formula (or formulaes) to achieve this include functions like if, Sumif, countif.
For example you put down 10 countif formulas for each of 1 to 10, to have 10 columns of how many 1 to 10 each combination has.
The formula is Countif(A1:E1;1), Countif(A1:E1;2) etc
Then you do a formula of Combin (24,'Result for1')*Combin(24,'Result for 2')*.....*Combin(96;'Result for 10').
That's it. You copy down the formulas to get all the results.

For only 43 combinations, this is not really needed, as it does not take long to do them. It does help though to do a single formula as you avoid mistakes.

If you know how to use Absolute and Relative formulas in Excel you do not need to write down 10 Countif formulae.
By having a Row of the numbers 1 to 10 above the formulae and using Countif($A1:$E1,'Cell above') then only this formula is needed to be copied 9 times to the other 9 columnns.
  • Jump to: