Subscribe via feed.

Stacked Deck

Posted by DP on February 25, 2011 – 12:52 pm

Andy, Bob, Charlie, and Dave are playing some cards. Dealer’s Choice.
When it’s Dave’s deal, he decides to play a game in which you are dealt 7 cards (out of a standard 52 card deck). The cards are dealt, and the player with the highest four-of-a-kind wins. If no one gets a four-of-a-kind, the cards are returned to the dealer, shuffled back in, and re-dealt. This is repeated until there is a winner.
What are the odds that Charlie has a for-sure win with all 4 aces?


This post is under “MathsChallenge, Tom” and has 102 respond so far.
If you enjoy this article, make sure you subscribe to my RSS Feed.

102 Responds so far- Add one»

  1. 1. JB Said:

    I may be wrong but I believe there are 133,784,560 possible combinations of 7 cards. I am also guessing that there are 17,296 combinations that would include the four aces. I would therefore calculate the odd as 1 in 7,735, but this is just a guess.

  2. 2. cazayoux Said:

    I guess stated another way …
    of the 1st, 5th, 9th, 13th, 17th, 21st, and 25th cards in the deck, that the four aces are captured.
    (assuming Charlie sits to Dave’s left)

    For the scenarios where these seven cards do not contain the four aces AND no other fours-of-a-kind win the round, then we deal again and get another shot for Charlie.

  3. 3. SP Said:

    My guess is 1/52.

  4. 4. Knightmare Said:

    do not read this-you’re better off-trust me

    odds that card 1 will be of X value- 1 to 1
    odds that card 2 will be of X value- 3 to 51
    odds that card 3 will be of X value- 2 to 50
    odds that card 4 will be of X value- 1 to 49

    odds of having 4 of a kind after 4 cards- 1.11923 %

    but in this game we get 3 more cards dealt to us,so we will take 1.11923 and add (1 in 48) + (1 in 47) + (1 in 46)= 1.18307 % of having 4 cards with the value of X.

    odds of X being an ace? 1 in 13. ( 0.07692 %)
    0.07692 * 1.11923=0.08609

    odds that charlie will get this hand and not the other three-1 in 4

    0.08609 * 0.25= 0.02152 % = the answer

    wait-i might have done something wrong……

    nope,looks good.

  5. 5. SOMEBODY Said:

    I BELIEVE THE ANSWER IS A NUMBER

  6. 6. JB Said:

    1 in 52 is the answer! 1 in 4 of winning and 1 in 13 of the winning hand being aces.

  7. 7. Chris Said:
    
       ■■  ■■■■■ ■■■■■ ■■■■■ ■   ■ ■■■■■ ■  ■■■  ■   ■  
      ■  ■   ■     ■   ■     ■■  ■   ■   ■ ■   ■ ■■  ■  
     ■■■■■■  ■     ■   ■■■■  ■ ■ ■   ■   ■ ■   ■ ■ ■ ■  
     ■    ■  ■     ■   ■     ■  ■■   ■   ■ ■   ■ ■  ■■  
     ■    ■  ■     ■   ■■■■■ ■   ■   ■   ■  ■■■  ■   ■  
    

    EDIT 11 June 2013: I have made a near definitive analysis of this problem. Skip straight to post 94 (and onwards). It’ll refer you back to only two earlier posts. Warning – it is not for the faint of heart.

    —-
    I just about always muck up these combinatorial problems, so I expect that I will this time too :(

    The number of possible hands someone can get (in a particular order) is 52*51*50*49*48*47*46 = 52! / 45! But as the order doesn’t matter, divide that by 7! => the number of possible hands is C(52,7) where C is the well know combinations function. NB It doesn’t matter that there are four people being dealt to.

    If you have 4 of a kind, then there are 48*47*46 / 3! = 48!/(45! * 3!)
    = C(48,3) possible choices for the other three cards. So the probability of having 4 aces is C(48,3)/C(52,7) = 1/7735.

    If aces are high, then the answer is 1/7735.

    But if aces are low??? “I’ll be back”. My brain is already rebelling.

  8. 8. Chris Said:

    Hmmm. I might be misinterpreting the question. 1/7735 is the absolute probability that 4 aces will be dealt to Charlie (i.e. regardless of any other consideration).

  9. 9. JB Said:

    Hi Chris. You made the same mistake that I made in the first post. Those are the odds for one deal. This game is played until someone wins.

  10. 10. Chris Said:

    Hi JB. I hadn’t noticed that we had the same answer. I was pretty sure that it wasn’t what was being asked for though. DP hasn’t said if aces are high or low. If they are high, then if Charlie gets them, he has won, so that makes the probability be 1.

    Unfortunately I think that aces must low, otherwise the question is too easy ;) . So we want the probability that none of the other players hold four of a kind, given that Charlie holds four aces. My first (and, so far, only) thoughts are that this might be a very difficult problem to solve. I say that because Charlie’s non-aces could be blocking 1, 2 or 3 other four of a kind hands – but that might not be the right way to look at it.

  11. 11. MrFrost Said:

    If I’m reading the question correctly then the odds are 100%.

  12. 12. JB Said:

    Chris, I have never been in a poker game where 4 aces did not beat out all other 4 of a kinds. You are right though if aces are low. That would make this a completely different problem that I would have to work out later.

  13. 13. DP Said:

    I’m posting this from my phone, so I’ll keep it short. Aces are high (which is why Charlie has a for sure win).
    JB, you didn’t mention any assumptions that you made, or show any calculations. No one has mentioned anything about the fact that I picked out a specific player from the 4 to win.

  14. 14. Chris Said:

    Hi DP, cazayoux has considered the deal order, as have I. It doesn’t matter as far as I can tell.

    But I’m baffled by the question. If Charlie has the four aces and that is the best hand, he’s won the game.

  15. 15. JB Said:

    Hi DP, I too have been posting from my cell phone and kept things brief. This response though is posting from my PC. Chris’ results for a single deal matched my first answer so I would think you can infer that I used the same calculations. My second post does show calculations, as simple as they might be.

    I, like Chris, cannot see the difference in whom you selected , nor the order of the deal. It seems to me that each player has the same odds of drawing any combination of cards and winning.

    And I, again like Chris, am curious to see what I apparently have been missing. I hope I never become too old to learn something new.

  16. 16. cazayoux Said:

    I think his odds are different than 1/7735.
    What if Charlie wins with four dueces?
    What if someone else wins with Aces?
    What if someone else wins with another four-of-a-kind?

    If there is no winner (nobody gets four of a kind), then Charlie hasn’t lost.

    We need to know the odds of
    1 – Charlie winning with aces (wanted)
    2 – Charlie wins with other four-of-a-kind (not wanted)
    3 – Someone else wins with four-of-a-kind (not wanted)
    4 – Nobody has a four of a kind (new iteration)

  17. 17. Chris Said:

    Hi cazayoux. Four aces is unbeatable and the question asks for the probability that he wins with four aces, not some other hand. If he’s got 4 aces he’s won, 100% definite. If not, who cares, he’s not got the stipulated 4 aces.

    I have assumed that it’s not a trick question, and as the only non-trivial thing left to calculate is the probability of Charlie being dealt 4 aces, and that’s what JB and I have calculated. The deal order and seating arrangements are irrelevant. All that matters is that Charlie is dealt 7 cards.

  18. 18. JB Said:

    If the question asked is what are Charlie’s odds on any one deal, then the answer should be 1/7735. If the question is what are the odds that Charlie will eventually win the game with 4 aces, then the odds are 1/52.

  19. 19. Chris Said:

    Hi JB. Now you’ve lost me. What do you mean? Eventually everyone will win the game with 4 aces, but they might have to play a lot of games before that happens.

  20. 20. Knightmare Said:

    Hi Chris. what do you mean eventually everyone will win? they will only deal out another hand if there is no winner. the game stops when at least one person has any 4-of-a-kind.

    me thinks you are reading the question wrong. it is not asking the odds of charlie winning if he has 4 aces. that is too simply to be called a question. it is asking for the odds of charlie being dealt 4 aces before the game is stopped.

    i like post 16 (cazayoux)

  21. 21. Chris Said:

    Hi Knightmare. I was just trying to get JB to explain what he meant in his post 18. I meant if the played an infinite number of games, every player would eventually get four aces.

    But I still don’t know what DP wants. His comments suggest that we haven’t answered his question. JB’s comment has floored me – I don’t know what he meant either.

    JB and I have both said 1/7735 is the probability that Charlie is dealt four aces.

    What do you think DP means? I haven’t the faintest idea what the question means.

  22. 22. JB Said:

    Chris, the game ends only when someone wins with 4 of a kind. Charlie has a one in four chance of being that winner. There are 13 possible 4 of a kinds that can win, aces being one of them. The question seems to be, what are the odds of Charlie getting 4 aces to end the game. The number of cards dealt to each player is irrelevant, as long as the number is between 4 and 7 since aces will always win. (This problem seems to ignore straight flushes.)

    The question would be more interesting if we had been asked the odds of winning with 4 deuces or 4 treys (and so on). Then there would be the possibility of a second hand with a better four of a kind. Even though the odds of that are slight, they are calculable.

  23. 23. Chris Said:

    Hi JB. I suspect that DP thinks that the deal order is important, and that’s why he appears to think that we haven’t answered the question. That’s why I posted the “Bags I nth” (which you answered correctly in your first post). But I was hoping for a demonstration, not simply a statement.

  24. 24. cazayoux Said:

    I maintain that there are three options for a game.
    It ends with Charlie and four Aces, it ends without Charlie having four aces, it doesn’t end.

    To use the notation from a recent problem

    E = 1 + p(bad win) + E*p(no win)

    E = [1 + p(bad win)] / [1 - p(no win)]

  25. 25. cazayoux Said:

    Another note.
    I don’t believe the order of the players around the table matters. (we would just as well be talking about a player other than Charlie)

    However, I do believe it matters that there are 4 people playing.

  26. 26. cazayoux Said:

    My apologies for another post so quickly.

    ‘E’ in post 24 would be the average number of games before Charlie wins with four aces.

    I guess 1/E is the probability that Charlie wins with four aces.

  27. 27. Chris Said:

    The rules seem to be, each player is dealt 7 cards. If no one has a 4 of a kind then the game is over. There is no suggestion that cards are discarded or replaced. It is sudden death – not really what I’d call a game at all.

  28. 28. Chris Said:

    I think I’ve got it. If any one of them holds 4 of a kind, then the game gets underway. Charlie presumably can discard and draw new cards. He might even have 3 deuces, but ditch those in the hope of picking 4 aces.

    If a real game is taking place, then I give up – I have never played any form of poker, so I can’t even begin to consider the possibilities. I’m aware that there are at least several different versions of the game.

    But I still can’t imagine wha the relevance of the deal order is.

  29. 29. SP Said:

    My understanding is that if there is no 4 of a kind, all the cards are returned, shuffled, and re-dealt. (This is not poker. You’re not exchanging only some of your cards.) Repeat until there’s a winner.

    Therefore, rounds prior to the first round that has a winner are irrelevant. In the winning round, there’s a 1/4 chance that Charlie is the winner rather than another player. There’s 1/13 chance that the winning hand has aces rather than another value. (As JB first explained in post 6.) Hence my guess of 1/4 * 1/13 = 1/52 total.

    However, aces beat other values. It’s possible that two or more players have four of a kind. Those rare situations would give aces the edge. So, that might make the chance that the winning hand has aces slightly better than 1/13. How to calculate that, I’m not sure.

  30. 30. Chris Said:

    Hi SP. Thanks for holding my hand, I now understand the question. I was definitely being Mr. Thickie.

    i.e. What is the probability that Charlie holding 4 aces, given that at least one person is holding four of a kind.

    I’m not convinced that 1/52 is the exact answer though, as it sems to assume that only one four of a kind has been dealt.

    I’m far from confident about the correctness of the following as this stuff makes my brain hurt: the probability of one four of a kind being dealt is 13/7735. The probability of two being dealt is (13/7735 * 12/7735)/2!, the probability of three being dealt is (13/7735 * 12/7735 * 11/7735)/3!, and the probability of four being dealt is (13/7735 * 12/7735 * 11/7735 * 10/7735)/4!. So the probability of at least one being dealt is the sum of those.

    If the above is right (which it may not be), then the relative probability that
    Charlie has the 4 aces is (I’ve eliminated the common 13/7735’s):
    (1/52) / (1 + (12/7735)/2! + (12*11/7735²)/3! + (12*11*10/7735³)/4!)
    ≈(1/52) * 0.99922454 i.e about 0.08% lower than 1/52.
    – Much later. That was rubbish, see post 91.

  31. 31. Chris Said:

    Even if I’ve goofed it a bit, I reckon that my correction is very close to what I’ve suggest (possibly it might be 0.16%). So was DP been doing a wind-up with his seating arrangements comment (#13)?

  32. 32. JB Said:

    Hi again, Chris. I just cannot see how the seating arrangement can affect the odds. As far as the odds of winning with aces, again I’ll stick with 1/52. I already took the chance of multiple 4 of a kinds into consideration, as I alluded to in my post #22. The odds of winning with any 4 other than the aces would diminish, the lower the 4 are, albeit by a very small amount (still not taking straight flushes, of which there are 60 of them, into consideration). I’m afraid my mind is too lazy to calculate exactly by how much right now.

    At the risk of sounding redundant, no matter how you slice it, there are 13 4 of a kinds. If Charlie gets 4 of a kind he has a 1 in 13 chance of them being aces, guaranteeing the win.

    If I am wrong, please advise.

  33. 33. cazayoux Said:

    What is the probability that none of the four players has four-of-a-kind?

    I’m not as good at probabilities as I would like and do not know how to do this.

    If there are C(52,7) possible seven-card hands, how do we handle that there are four players.
    Would the second player have C(45,7) possible hands?
    Would the third have C(38,7)?
    Would the fourth have C(32,7)?

  34. 34. Chris Said:

    Hi cazayoux. It’s 1 – prob(1 or more dealt)

    However, I’m sure that my calculations for the probabilities of multiple four of a kinds are wrong and that my correction factor is about 8% (wild guess) in error. Unfortunately, I suspect that the true calculations are horribly involved, especially as there are 4 players.

    Hi JB. The probability of Charlie winning with all 4 aces is the probability of him getting 4 aces divided by the total number of cases where at least one player got a four of a kind. It’s the “at least” that you’ve not taken into account. You’ve assumed that only one four of a kind has been dealt, and so not included games where 2,3 or 4 have been dealt. i.e you’ve allowed 1/4 of 13 possible deals, it’s a tad more that 13 possible deals that start a game. I’m fairly sure that I’ve done the right type of calculation, but I’ve goofed up the probabilities of getting 2,3 or 4 four of a kinds.

    I’ll have a rethink about them, but suspect that it’s too difficult (for me).

    I assume that flushes etc., are irrelevant. If not, I unconditionally give up. Even if I knew how to play the game (I only suspect that you can swap cards, and I have no idea how often you can do that), the calculations are horrendous. I believe that e.g. straight flushes of 5,6 or 7 cards would beat four aces. My mind boggles at what’d be involved in allowing for that. I fancy that slavy, although quite capable of calculating it, isn’t masochistic enough to take that on, especially if you can swap cards.

  35. 35. Chris Said:

    Hi cazayoux. I’m not sure about those C(x,y) figures you gave. I’ll be back real soon.

  36. 36. JB Said:

    Hi Chris,

    Just for your edification, the order of winning hands is:

    High card(s)
    1 pair
    2 pair
    3 of a kind
    straight
    flush
    full house
    4 of a kind
    straight flush (including royal flush)

    As far as multiple 4 of a kinds I don’t think it matters as to how many 4 of a kinds are dealt in that one deal. If Charlie has 4 of a kind, the odds are 1/13 that it is aces. It is true that the odds of two or more hands including Charlie, holding 4 of a kind are drastically small, but for this example, at least two did come up with it.

  37. 37. Chris Said:

    Hi JB, those extra hands would make the calculations unbelievably difficult. However, DP said that 4 aces is the for sure winner, so we can ignore them (phew).

    I accept your argument; I cannot see a flaw with it. Also, I do have some doubts about my argument – a sure sign that I’ve goofed.

  38. 38. JB Said:

    Don’t admit defeat quite yet Chris.

    I had an epiphany and maybe you are basically right after all. While it is true that each foursome has a 1 in 13 chance of ending up in Charlie’s hand, only aces is a sure win. Therefore, the odds of each foursome other than aces winning is 1/13 to add up to 1/4. It is tedious to calculate the chance of winning with each foursome and, again, I’m just too lazy and my brain hurts. Maybe we should put this puppy to bed.

  39. 39. JB Said:

    Somehow, some of my message got lost above. It should have said:

    While it is true that each foursome has a 1 in 13 chance of ending up in Charlie’s hand, only aces is a sure win. Therefore, the odds of each foursome other than aces winning is 1/13 to add up to 1/4.

  40. 40. JB Said:

    One last try before I give up. For some reason my replies are losing content upon posting.

    While it is true that each foursome has a 1 in 13 chance of ending up in Charlie’s hand, only aces is a sure win. Therefore, the odds of each foursome other than aces winning is less than 1/13. Therefore, the odds for aces must be greater than 1/13 to add up to 1/4.

  41. 41. JB Said:

    Sorry, My bad. Make the odds 1/52, not 1/13.

  42. 42. Chris Said:

    Hi JB. I’ve been trying to calculate the odds of two four of a kinds being dealt, so my brain really hurts quite a lot. In fact I’m about to take it to bed (it’s almost 4:30 am here).

    But I haven’t absolutely definitely completely given up on challenging the 1/52, but I’m giving it a rest until I’m more alert and can see the reason why my challenge is right or wrong.

    I’ve invested too much time on this to not see it through to the end ;) I wanna know how to do it.

  43. 43. JB Said:

    Chris, I think I already proved that 1/52 is wrong. There are 13 possible 4 of a kinds. If the odds for aces is 1/52 and the other 12 are less than 1/52 they would add up to less than 13/52 or 1/4, the odds of Charlie winning. I believe my error was in using 1/4 as a constant multiplier.

    The odds of a particular person getting any 4 of a kind are 13/7735. The odds of any of the 4 getting 4 of a kind would then be 4 times as likely, or 52/7735. The odds of any two would be 52/7735 * (12 * 3)/7735. For 3 individuals it would be 52/7735 * 36 /7735 * 22/7735, and for all 4 would be 52/7735 * 36 /7735 * 22/7735 * 10/7735, a really small number.

    I do not believe that these particular odds are the ones needed to solve this puzzle. I have an inkling on how to solve it but I will have to wait a while before I can again give attention to this. Hopefully, you will have the answer the next time I look in.

  44. 44. cazayoux Said:

    JB

    I need help understanding why any of the 4 getting a four of a kind would be 4 times as likely.
    If one person does not have a four-of-a-kind, it has taken the opportunity of four-of-a-kind away from the other players for every value of card already held in hand. (possibly 7 different ones).

    If one player has [2,3,4,5,6,7,8] then the other players only have six possible fours-of-a-kind as even possible in their own hands.

    It seemst that the next person is much less likely to get a four-of-a-kind.

    I’m realizing that maybe I shouldn’t be looking at this sequentially. Hm…..

    This is a good one.

  45. 45. JB Said:

    cazayoux,

    Each player has a 13/7735 chance. Four players quadruple the odds of someone, anyone getting 4 of a kind. There is no sequential consideration here. Each player has 7 cards with an equal chance at 4 of a kind.

  46. 46. cazayoux Said:

    So one player has a 7722/7735 chance to not have a four-of-a-kind.
    What is the probability that none of the four players do?
    Is it (7722/7735)^4?

  47. 47. JB Said:

    The odds of nobody winning on any given deal are:
    (7735 – (13 * 4)) / 7735 or 7683/7735.

  48. 48. Chris Said:

    In case you’re wondering, I am working on my magnificent octopus.

  49. 49. JB Said:

    Chris, I have no idea what that means but I wish you success. In the meantime, let me offer a little insight to what I believe is the solution to this puzzle. The odds of 2 hands, 3 hands or 4 hands with four of a kinds is not relevant. What matters is, what is the probability of any of the 3 remaining hands beating Charles foursome. For instance, if Charles has 4 kings then the odds of being beat are 3/7735, i.e. three hands each with a 1/7735 chance of beating the kings. For queens the odds are 2*3/7735; jacks are 3*3/7735, and so on. It does not matter if 1, 2 or 3 hands beat Charles. He still loses.

  50. 50. Chris Said:

    Hi JB, I guess you’re not a Black Adder fan. It meant magnum opus.

    As my brain is in danger of leaving it’s current place of residence, I thought that I’d write up some material in the desperate hope that I can make any sense of this stuff.

    Consider dealing cards to two players. The first player can be dealt C(52,7) different hands. For each of those, the second player can get C(45,7) different hands. So the total number of ways of dealing to two players is C(52,7)*C(45,7).

    C(52,7)*C(45,7) = 52!/(45! 7!) * 45!/(38! 7!) = 52!/(38! 7! 7!)
    = C(52,7,7) = 6071092494667200 ≈ 6.07 * 10^15
    Where I have introduced C(n,r,s) = n!/((n-r-s)! r! s!) = C(n,r)*C(n-r,s)
    Also note that C(n,r) = C(n,n-r) so C(n,r,s) = C(n,n-r)*C(n-r,s).

    NB of course each player can get C(52,7) combinations. My analysis was just a
    means to an end. You would get the same final result if you were to consider
    dealing the card in an alternating fashion (or any arbitrary sequence) e.g.:
    (52*50*48*46*44*42*40)/7!*(51*49*47*45*43*41*39)/7! = C(52,7,7)

    For interest, if had dealt 14 cards to one hand, we’d only have got
    C(52,14) ≈ 1.77 * 10^12 combinations.

    It is pretty obvious that if we were dealing to 4 players, that the total number
    of combinations would be C(52,7,7,7,7) = 52!/(24! 7! 7! 7! 7!) ≈ 2.01*10^29

    NB C(52-a-b,7-a,7-b,7,7)/C(52,7,7,7,7) = C(52-a-b,7-a,7-b)/C(52,7,7)
    That’s lucky as that is applicable throughout this analysis.

    Let the first player be dealt a particular four of a kind (pfoak). Then there are 48*47*46 / 3! = 48!/(45! 3!) = C(48,45) = C(48,3) ways of choosing the last three cards. Hence, the probability of the first player being dealt a pfoak is C(48,3)/C(52,7). NB if we were dealing to 4 players, we might calculate that as C(48,3,7,7,7)/C(52,7,7,7,7). You get the same result either way.
    The probability that two players get a pfoak is C(44,3,3)/C(52,7,7)
    The probability that four players get a pfoak is C(36,3,3,3,3)/C(52,7,7,7,7)
    The probability that seven players get a pfoak is
    C(24,3,3,3,3,3,3,3)/C(52,7,7,7,7,7,7,7).

    We can’t go to eight players because C(52,7,7,7,7,7,7,7,7) isn’t defined (it
    would involve (52-56)! = (-4!) = ±∞ although C(24,3,3,3,3,3,3,3,3) is, but only
    because 0! = 1. However, the ratio C(24,3,3,3,3,3,3,3,3)/C(52,7,7,7,7,7,7,7,7) = 0. That seems sensible.

    October 2011. My analysis has a subtle flaw (fixed on the Stacked Deck page at about post 91 http://trickofmind.com/?p=808#comment-7640 ). So I’ve deleted the rest of this comment.

  51. 51. Chris Said:

    I think I goofed near the end. The coefficients should be 13,13*12,13*12*11 and 13*12*11*10. But I hardly know what day of the week it is at the moment. I want my brain back.

  52. 52. Chris Said:

    A few notes on post 50. The correction in post 51 is correct. Define the permutation function P(n,r) = n!/(n-r)!, then P(n afoak) = P(13,n)*P(n pfoak).

    The P(n xfoak) probabilities are independent of the number of players being dealt to. That’s because e.g. C(44,3,7,7,)/C(52.7.7,7) = C(44,3)/C(52,7), or if you prefer, it’s because P(n pfoak) = (52-4n)!/52! * (7!/3!)^n is independent of the number of players. That “Bags I nth” problem sheds further light on that possibly counter-intuitive behaviour. I might add some notes on that page. In other word, the probabilty of dealing e.g. 4 aces to one of the players, is independent of the number of players.

    cazayoux was interested in the probabilty of no foaks being dealt. As we are dealing to four players, if n < 4, then we must interpret P(n afoak) as being the probability of etting at least n afoak. So probability of getting exacly n afoak is P(n afoak) – P(n+1 afoak). So the probability of getting no afoak is 1 – P(1 afoak) = 7722/7735; not (7722/7735)^4

    I think that concludes that stuff. If anyone thinks I've goofed anywhere, please tell me. In particular, I've been flying by the seat of my pants for the last bits.

    If you want to extend this to two decks, or three of a kind or pairs, you're better be made of stern stuff – those extensions are major jobs. I expect that slavy is made of the right material to do it.

  53. 53. JB Said:

    Chris,

    I will have to disagree with you on the chances of no one getting foak. The odds of 1 person not getting foak are 7722/7735, but we have 4 hands with equal odds of foak. Therefore, the odds of no one getting foak are (7735 -13*4)/7735 or 7683/7735.

    I finally got around to calculating the odds of winning with each foak. odds for Charlie winning with aces is 0.019275625, which is greater than 1/52. The odds of winning with all foaks are:

    ace 0.019275625
    king 0.019268149
    queen 0.019260673
    jack 0.019253197
    10 0.019245721
    9 0.019238245
    8 0.019230769
    7 0.019223293
    6 0.019215817
    5 0.019208341
    4 0.019200865
    3 0.019193389
    2 0.019185913

    0.250000000

    I can post the calculations if I can figure out how to display them here.

  54. 54. DP Said:

    Wow. I’m impressed at the progress made on this problem. Much more complicated than I first thought. Not that this was what I was going for, but it looks like I’ll be shaking hands with Chris, who holds 3 of the top 5 “most popular” posts. My appologies to Karl. You held it for a while.

    Now, to the problem at hand. I was going to (at some point) lay out what we do know to begin to simplify it back to it’s roots. After reading through Chris’ revelations in post #52, I decided that it probably wasn’t necessary anymore. I think we are beyond that now.

    I also wondered if it would help to add in some details like the cards are dealt alternately (Andy, Bob, Charlie, Dave -or- A,B,C,D if you prefer) and that Charlie was third. But then I thought it was more worth-while to have the general solution. If seating order really doesn’t matter, then the probabilities would be the same. If it does, then it would be nice to see what the probability was for each seat (dealt to first, second…).

    Or if your assumption is that the dealer gives 7 cards to the first, then 7 cards to the second and so-forth, just be sure to state that. I didn’t lay out any of those rules in the problem statement, but that doesn’t mean that they might not matter.

    JB, it looks like you’ve got some pretty final numbers. It would be good to see the “exact” numbers/calcs if you have them. Again, we’re looking for Aces, but it is nice to see the rest while we’re at it. I’m wondering how confident you are in those numbers, and how well you will defend them.

    Again, Good work guys (and girls?). I’m wondering where Slavy is in all of this. Wouldn’t it be great for him to swoop in and just lay it all out for us?

  55. 55. Chris Said:

    Typos in post 50.

    It is pretty obvious that if we were dealing to 4 players, that the total number of combinations would be C(52,7,7,7,7) = 52!/(31! 7! 7! 7! 7!) ≈ 2.01*10^29

    Should have been:
    It is pretty obvious that if we were dealing to 4 players, that the total number of combinations would be C(52,7,7,7,7) = 52!/(24! 7! 7! 7! 7!) ≈ 2.01*10^29, as 52-7-7-7-7 = 24

    I’d accidentally got 31 after editing out a three player case which had yielded 52-7-7-7 = 31

    I should have done all this stuff on my own pages so that I could fix up errors.

  56. 56. DP Said:

    Chris,
    I made that edit for you. I don’t want to step on any toes, but I’ll gladly make edits for you if you would rather the post be correct than to make an edit post.
    I would make your post #50 edits, but I’m affraid I lost track of where you are referring to.

  57. 57. Chris Said:

    Hi DP, I had considered the alternate dealing in post 50, para 4 – it makes no difference.

    I am struggling with a detail; until I get that sorted, I can’t deal with JB’s post 53.

    I had noticed tha you’re about to displace Karls Naughts and Crosses problem.

  58. 58. Chris Said:

    Hi DP, thanks for fixing that error. Don’t worry about the others, the comments are very near to each other. Besides, I might be about to make a significant correction.

  59. 59. DP Said:

    Ok, I won’t worry about the corrections. I think most people can follow what you mean anyway. It’s probably just me that can’t. =)
    By the way, it wasn’t only Karl that was affected. It appears this one has jumped ahead of your own “sharing the gold” problem. That was a fun one that almost anyone was able to jump in for an answer. Maybe I’ll try and come up with one similar to that next time.
    I’ve got a couple in the wings right now, but decided not to post them quite yet. one is a bit easier than this one, but the other is another compound probability one (or whatever that is called).
    I may not ever post the problem as-is, since it is so difficult. I haven’t even tried to attempt it, only thought it up. The easy one may be a well-deserved break for brains after this one.

  60. 60. Chris Said:

    Hi DP. One more for the the hall of fame ranking. You might even displace Black or White before I’m done.

    The flaw might be basic. i.e. I think that e.g. P(1 pfoak) should be multiplied by the number of players. I’ve been out shopping and now have to eat. So probably a few hours before I can post again; if I don’t do it in the next 10 minute coffee break.

  61. 61. JB Said:

    I guess I’ll add to the record attempt. I’m using my phone so i wll be brief.

    All the pieces of the puzzle are buried in my earlier posts. The key is, the odds for each foak winning must add up to .25. The next step is to degermine the odds off each foqk losing and subtracting that from 1. Kings can be beaten only by aces. Therefore, the odds of king winning are 1- 1 * 3/7735; queens 2 * 3/7735;….deuces 12 * 3/7735. Add all the winning odds together and divide into each winning odds times .25 and you get the overall odds of each foak winning.

    I hope I am explaining this correctly since I do not have my work in front of me. Am I certain? Yeah, but I was certain and wrong before.

  62. 62. Chris Said:

    Bump record attempt counter. I have posted a complete rework of post 50 on the “Bags I go nth” page: http://trickofmind.com/?p=819#comment-4701, I’ve put it there so I can easily fix any errors etc.

    Needless to say, I was wrong in posts 52 and 53. The coefficients were C(13,n) after all.

    Clearly JB’s brain works better than mine. I agree, the probability that no one gets a foak is 7683/7735 = 591/595.

    Unfortunately, I’ve got to go out for a few hours. Then, perhaps I’ll reconsider the original problem.

    Meanwhile, here is a list of probabilities (enjoy ;) :
    P(n pfoak) = (52-4n)!/52!*3360^n (I’m confident about that)
    P(1 pfoak) = 4/7735 = 1/1933.75
    P(2 pfoak) = 4/10750545 ≈ 1/1639.401^2
    P(3 pfoak) = 16/41697063837 ≈ 1/1376.138^3
    P(4 pfoak) = 224/381069466406343 ≈ 1/1142.060^4

    NB P(n afoak) = C(13,n)*P(n pfoak)
    P(1 afoak) = 1/148.75
    P(2 afoak) = 1/34 456.875 ≈ 1/185.625^2
    P(3 afoak) ≈ 1/9 112 120.594 ≈ 1/208.869^3
    P(4 afoak) ≈ 1/2 379 304 860.179 ≈ 1/220.858^4
    (I have used spaces to break into 3 digit groups)

  63. 63. DP Said:

    It looks like Chris has come to his conclusion. It looks like he’s going with a 1/1933.75 chance that Charlie will get a four-of-a-kind (foak) that is ACES. This solution explains that there are equal chances of getting any single, particular foak, which we would expect.
    One other thing to note, which I haven’t yet seen direct reference to is that we can ignore any games played where there is no foak. Because of the re-deal rule stated in the problem, we can assume every time the cards are dealt that we start over.
    JB has some probabilities posted that were achieved by a different method, but I’m affraid the one we are interested in does not match the one posted by Chris. JB states the chances of winning with each foak (which is useful to know), but assuming Chris has it correct, the chance of getting 1 pfoak should be the same as winning with aces, since if Charile gets 4 aces, he wins.
    What do you guys think? Will there be an agreement between your solutions?
    It looks like JB might be using a more blunt way of calculating (compared to the general solutions of Chris), but I’d like to see the calcs to post #53.

  64. 64. Chris Said:

    Hi DP. I knew what I was doing was only faintly related to the posted problem. I also suspect that my post on the “Bags I nth” has a fault. But I’ve got to go out for a few hours.

  65. 65. JB Said:

    The original question asked about the odds of winning with aces, not the odds of getting aces. AS I have mentioned in earlier posts, Charlie has an equal chance of getting 4 aces as he does 4 deuces, but he does not have an equal chance of winning with deuces. That fact alone means that he has to have better odds of winning with aces. He simply has more ways of winning with them! I am afraid that I will have to stick with my numbers for right now.

    DP, I guess I am defending my position.

  66. 66. Chris Said:

    Hi JB and DP. I’m not (currently) disagreeing with JB. I had long ago moved on to the more general problem – it may or not be the basis for disputing JB 1/52 (which I believe is correct).

    If I do challenge, it’ll be to do with the semantics of the question. But, I’ve made a serious goof, It’ll be fixed in 10 minutes or so.

  67. 67. Chris Said:

    I’ve pretty much done with all the calculations on my extension of the problem. It was hard work and I made a phenomenal number of goof ups getting there, but I enjoyed it, so thank you DP for giving me the excuse to do that. Here are my final probabilities (the others were written by an impostor ;) :
    P(n pfoak) = 4!/(4-n)! * (52-4n)!/52! * 840^n.
    P(1 pfoak) = 4/7735 = 1/1933.75
    P(2 pfoak) = 1/3 583 51510750545 ≈ 1/1893.0174^2
    P(3 pfoak) =2/13899021279 ≈ 1/1908.321^3
    P(4 pfoak) = 7/127023155468781 ≈ 1/2063.936^4
    NB P(n pfoak) is the probability of at least n pfoaks
    (I have used spaces to break into 3 digit groups)

    Now for the any old foak probabilities. There are
    C(13,n) ways of choosing n pfoaks, so p(n foaks) = C(13,n)*P(n pfoaks)

    P(1 foak) = C(13,1)*P(1 pfoak) = 4/595 = 1/148.75
    P(2 foak) = C(13,2)*P(2 pfoak) = 2/91 885 ≈ 1/214.342^2
    P(3 foak) = C(13,3)*P(3 pfoak) ≈ 4/97 195 953 ≈ 1/289.643^3
    P(4 foak) = C(13,4)*P(4 pfoak) ≈ 35/888 273 814 467 ≈ 1/399.135^4

    The probability of being dealt no foaks is:
    1-1/148.75 = 591/595 ≈ 0.993277

    All of those probabilities are for the foaks being dealt to the players collectively, not individually. The probability that a particular player would get 4 aces is 1/7735.

    My calculations: http://trickofmind.com/?p=819#comment-4701

    One day, I might actually get round to doing the posted problem.

  68. 68. Chris Said:

    Rats, editing errors – the pfoaks should have read:
    P(n pfoak) = 4!/(4-n)! * (52-4n)!/52! * 840^n.
    P(1 pfoak) = 4/7735 = 1/1933.75
    P(2 pfoak) = 1/3 583 515 ≈ 1/1893.0174^2
    P(3 pfoak) =2/13 899 021 279 ≈ 1/1908.321^3
    P(4 pfoak) = 7/127 023 155 468 781 ≈ 1/2063.936^4
    NB P(n pfoak) is the probability of at least n pfoaks
    (I have used spaces to break into 3 digit groups)

  69. 69. JB Said:

    Here are my (hopefully) final thoughts on this subject.

    The odds of winning are 1/4. The odds of drawing 4 of a kind and that foak is aces is 1/13. Drawing foak does not guarantee winning. Therefore, you cannot draw the conclusion that the odds of the winning hand being aces are 1/13 * 1/4. The only way the odds of winning with 4 of a kind can be 1/52 is if the rules state that if there are more than 1 foak then it is a draw.

    Ironically Chris, I have to thank you for challenging my original position of the answer being 1/52. It made me take a closerer look at my line of reasoning and seeing the fatal flaw.

  70. 70. DP Said:

    Maybe we should put this one to rest. I’m sure you are both ready for bigger, better things. No more time for distraction from fancy shuffling and wild dealing.
    Make sure to get some sleep Chris. I’ve noticed that to be your trend. I think in maybe 20% of your posts you mention something about needing to get to bed.
    Just one post away from “Black of White?”, another great problem that people from all walks of life seemed to be interested in.
    Thanks for making this another classic.
    Now maybe I’ll post that other problem I was talking about… Or maybe I’ll just start with an easy one. We’ll see.

  71. 71. Chris Said:

    I’d been looking for this problem to help me with Karl’s just posted Lottery Choice problem. I can’t believe how badly I failed to understand the question. When I’m thick, I’m pro grade at it. I don’t mind as I had fun learning loads of irrelevant stuff on card dealing.

    As has been pointed out (probably more than once) all that was being asked was what was the probability that Charlie would be dealt 4 aces before anyone (including Charlie) was dealt any four of a kind. So DP was right, it’s 1/52. It doesn’t matter that 4 of a kind is rare etc. There’s 1 chance in 13 that the first 4 of a kind is aces, and 1 chance in 4 that it’s dealt to Charlie.

    10 miutes later: now I’m not so sure. If I remember, I’ll re-check. My problem is to do with what if more than one for of a kind is dealt – can I still say 1 in 13? Whatever 1/52 is at least very close to the right answer.

  72. 72. DP Said:

    Chris, hopefully this will help. Check post #13. I state that Aces are high, so if more than 1 four-of-a-kind is dealt in one hand, Aces would win anyway.

  73. 73. Chris Said:

    Hi DP. Now I’ve finished Karl’s lottery problem, I’m about to re-examine this one. I can see from the comments above that I took ages to understand the question. I now realise what the question is asking, and recognise that the question has been stated clearly. My reading is: the only hands of interest are foak (four of a kind). We want the probability that the first time a foak or foaks are dealt, that Charlie has been dealt 4 aces. I like the answer 1/52 very much, but I just can’t decide if it is correct to say that there is exactly 1 chance in 13 that 4 aces will be dealt when two or more foaks are dealt. If only one foak was dealt, then I’m happy with the 1 in 13 of it being aces. My brain just doesn’t work right when it comes to deciding what’s going on.

    It’s my birthday (fifty bloody nine) and I’m not going to be able to do much for quite a few hours. But I’ll be mulling it over.

    I only saw your comment because I’m about to drive home from my brother’s house, and was really checking for spam and pending comments (as I’m a site administrator).

  74. 74. Chris Said:

    Hi DP. I had started to write that I’m now happy with 1/52. But I’ve changed my mind. Here’s why. If we consider a deal in which exactly one pfoak (particular foak) is dealt, then there is a 1 in 13 chance that it’s 4 aces, and 1/4 that it’s dealt to Charlie. So that gives 1/52.

    However, there is, very roughly and only for the purpose of discussion, a 1 in 10000 chance of the first foak deal actually being exactly 2 foaks. In that case there are C(13,2) = 78 pairs of pfoaks, and 12 of those pairs involve 4 aces (i.e. A+2,A+3,A+4,…A+Q,A+K). Then the (relative) probability of dealing 4 aces is 12/78 = 2/13 (which is also directly obvious). There is a 1/4 chance that Charlie gets the 4 aces. So Charlie has a 1/4*2/13 = 1/26 chance of getting 4 aces [in a double foak deal]. Altogether that means Charlie has a probability of winning the game with 4 aces of approx (1/52)(1-1/10000) + 1/260000 = (1/52)(1 + 1/10000) > 1/52. That hasn’t allowed for 3 or 4 foaks being dealt. Again, take the 10000 as being a placeholder.

    Of course my brain is rebelling, and I absolutely reserve the right to be wrong. But I don’t see a fault in my reasoning. If I’m right, I’d have to recheck most of my previous stuff, as I suspect I’ve dropped a few clangers, before I could give the correct exact answer).

    Am I stubborn, or am I stubborn?

    EDIT 10 June 2013: Here’s the easy way to see it. On average, more than one foak must be being dealt per game. 1/13 must be aces, and 1/4 must go to Charlie, so more than 1 in 52 go to Charlie (per game).

  75. 75. Chris Said:

    I’m now labouring under the possible delusion that I’ve not made a major error. Let p(k) = the probability of dealing exactly k foaks (to the table) given that we have dealt at least one foak. Then p(1)+p(2)+p(3)+p(4) = 1.

    In each case p(i) ≈ 300 p(i+1). (That 300 is only about right for i = 1).

    If we have exactly 1 foak, then the probability that 4 aces were dealt is 1/13, and so the probability that Charlie gets 4 aces is (1/4)(1/13) = 1/52.

    If we have exactly 2 foaks, then the probability that 4 aces were dealt is 2/13, and so the probability that Charlie gets 4 aces is (1/4)(2/13) = 2/52.

    If we have exactly 3 foaks, then the probability that 4 aces were dealt is 3/13, and so the probability that Charlie gets 4 aces is (1/4)(3/13) = 3/52.

    If we have exactly 4 foaks, then the probability that 4 aces were dealt is 4/13, and so the probability that Charlie gets 4 aces is (1/4)(4/13) = 4/52.

    Altogether, the probability of Charlie winning with aces is:
    Pcwa = (p(1) + 2p(2) + 3p(3) + 4p(4))/52. Can see that rather more directly than I showed above by noting that p(1) + 2p(2) + 3p(3) + 4p(4) is the average number of foaks dealt, and so on average we expect 1/13 to be aces and 1 in 4 of them to go to Charlie.

    Now to estimate the probability of Charlie winning. Using p(1)+p(2)+p(3)+p(4) = 1 => Pcwa = (1 + p(2) + 2p(3) + 3p(4))/52. That expression is exact. As p(2) is easily the largest term and is in the neighbourhood of 1/300, that gives Pcwa ≈ 1.0033/52. Unfortunately, to unequivocally distinguish that from 1/52 would require 10 trillion (US) trials using Monte Carlo methods. The simulation might take a few hours to a few days to run, but it is way beyond VB’s Rnd() capabilities.

    Later: I’m confident that I’ve not goofed (this time). I am now going to recheck my earlier probability stuff. I’m pretty sure I can correct any errors quite easily.

  76. 76. Chris Said:

    I’ll try to compress all my previous posts about probabilities into this comment. If there is a conflict between what I said previously and this, this one overrides the previous.

    MUCH LATER (10 June 2013). The details are wrong. The result is wrong too. First correct version is in post 91. But, I’ve written a better version in post 94.

    Reminder, I had introduced the extended combinatorial function
    C(n,a,b,c,d) = n!/((n-a-b-c-d)! a! b! c! d!). I also noted that e.g. C(52-a-b,7-a,7-b,7,7)/C(52,7,7,7,7) = C(52-a-b,7-a,7-b)/C(52,7,7) and used this to claim that the probability that a particular player is dealt a pfoak (a particular foak e.g. 4 aces) is independent of the number of players (as long as there’s less than 8 players). The probability that a particular player receives a pfoak is C(48,3)/C(52,7) = 1/7735. Aside: the probability that a particular player will receive a foak is 13/7735 = 1/595, which gives the odds of getting a foak as 1 to 594, but neither is is needed for my analysis. I will only be considering 4 player games. It happens, that we will always finding the probabilities by dividing by C(52,7,7,7,7), so I now define
    P(n,a,b,c,d) = C(n,a,b,c,d)/C(52,7,7,7,7). We’ll also find that if N is the the number of pfoaks, that n = 52-4N. Altogether the probability of player 1 receiving a pfoak = P(48,3,7,7,7), player 1 and 2 => P(44,3,3,7,7), players 1,2,3 => P(40,3,3,3,7), and for players 1,2,3,4 => P(36,3,3,3,3). Although I’ve chosen definite players, that choice was arbitrary. e.g. the probability that a pfoak is dealt to player 2 is P(48,7,3,7,7), that, of course, has the same value as P(48,3,7,7,7).

    As there are 4 players, the probability of a pfoak being dealt to the table is 4 times the individual player’s probability. Further, the calculation didn’t guarantee that only one foak is dealt. So the probabilty that at a pfoak is dealt to the table is 4/7735 but that doesn’t imply that no other foaks were dealt. As there are 13 pfoaks, the total probability of at least one foak being dealt to the table is 4*13*P(48,3,7,7,7)
    = 52P(48,3,7,7,7). For 2 pfoaks being dealt there are 4!/(4-2)! = 2! C(4,2) = 12 ways that the two pfoaks could have been dealt to the four players (aka the table). NB I could use the permutations function P(n,a) = a! C(n,a), but the P might be mistaken for a probability, so I’m avoidiing doing that. There are also C(13,2) = 78 possible pairs of pfoaks. So the probability of dealing (at least) two foaks to the table is 2! C(4,2) C(13,2) P(44,3,3,7,7). Likewise, the probability of dealing at least 3 foaks is 3! C(4,3) C(13,3) P(40,3,3,3,7). For 4 foaks, the probaility of dealing (exactly) 4 foaks is 4! C(4,4) C(13,4) P(36,3,3,3,3).

    Now for the probabilities for dealing exactly 1,2,3 foaks. I’ll use pa(i) to denote absolute probabilities, bear with me, also note 52 =1! C(4,1) C(13,1):
    pa(1) = 1! C(4,1) C(13,1) P(48,3,7,7,7) – 2! C(4,2) C(13,2) P(44,3,3,7,7)
    pa(2) = 2! C(4,2) C(13,2) P(44,3,3,7,7) – 3! C(4,3) C(13,3) P(40,3,3,3,7)
    pa(3) = 3! C(4,3) C(13,3) P(40,3,3,3,7) – 4! C(4,4) C(13,4) P(36,3,3,3,3)
    pa(4) = 4! C(4,4) C(13,4) P(36,3,3,3,3)

    pa(1) = 862/128639 ≈ 0.00670092273727252 ≈ 1/149.233178654292
    pa(2) = 10558/485979765 ≈ 0.000021725184381 ≈ 1/46029.5287933321
    pa(3) = 36521/888273814467 ≈ 4.1114575*10-8 ≈ 1/2.432228*107
    pa(4) = 35/888273814467 ≈ 3.9402265*10-11 ≈ 1/2.5379252*1010

    And almost finally, we want the probabilities of dealing exactly 1,2,3,4 foaks given that we’ve dealt at least 1 foak. That is p(i) = pa(i)/P(48,3,7,7,7] Refer to comment 76 for more details.
    p(1) = 2155/2162 ≈ 0.996762257169288
    p(2) = 36953/11434818 ≈ 0.00323162117665537
    p(3) = 1278235/209005603404 ≈ 6.11579297005363*10-6
    p(4) = 1225/209005603404 ≈ 5.86108688020254*10-9

    So p(2)/p(1) ≈ 0.00324211832200877 ≈ 1/308.440316077179 and
    p(3)/p(2) ≈ 1/528.406 and p(4)/p(3) ≈ 1/1043.457. So my placeholding 10000 was quite a bit off. (In fact I’d chosen 10000 because I remembered the value 7735).

    Finally the probability of Charlie winning is (using a result from post 75):
    (p(1) + 2p(2) + 3p(3) + 4p(4))/52 =(1487117663/1482309244)/52 ≈1.00324387034586/52

    That is feasible to check with Monte Carlo methods. 10 million trials should unequivocally confirm the result, and VB’s Rnd() function is good enough. Hi Ragknot ;)

    June 17 2013: The correct value is 1.0032421043096/52. Correct theory is in post 91

  77. 77. Chris Said:

    Wow. I’ve just re-read SP’s post 29. He was on the ball.

  78. 78. Chris Said:

    Hi JB. Although I see it’s in the trash, I guess you’ve not quite yet understood my post 75. I stand by it, LOL I now think it’s obvious. For what it’s worth, and purely for the heck of it, I’m going to write a simulator – I’m doing that as much as anything, because I’ve never written one for a card game.

  79. 79. DP Said:

    Chris,
    To be fair, I was just going back through the posts and saw that post #32 was posted twice. I was just cleaning up this problem (and plan on correcting post reference #s) to make it fair, since this is about to make the top 5. I didn’t want it to be because there were duplicate posts.
    It looks like you’re getting pretty confident in your answer. I think it took you until around post #30 to realy get what the question was asking. I suppose you give credit to SP for helping, although cazayoux (post #16) and JB (post #22) tried to convince you =).
    Anyway, I’m still in the process of going back through all responses to compare everyone’s answers and hopefully finish this one off.

  80. 80. Chris Said:

    Hi DP. I hadn’t realised that you’d deleted an old post. I simply saw one in the trash and assumed it was new.

  81. 81. Chris Said:

    I also see JB’s post 43 was mighty close too. Now this is number 4 popular post :)

  82. 82. Chris Said:

    Here’s a Monte Carlo proggy: Stacked Deck MC

    My first run with 1 million trials gave 1.007448/52.

    I have just started a run with 10 million trials. But that’ll take 6 hours.

  83. 83. DP Said:

    Is there a reason why you would “randomly” shuffle the deck, rather than run through every possibility of a shuffled deck (suits included)? Maybe that would be something slightly less than 10^68 trials, so not computable?

  84. 84. Chris Said:

    Hi DP. There are C(52,7,7,7,7) = 201474727133525966905424640000 ≈ 2*1029 deals. Assuming I simulated the games at the same speed as with the present code, I calculate that it’d take around 1 billion times the present age of the universe to run it.

    I also realise that perhaps the VB Rnd() may not be good enough after all.

    Anyway, at around 2 million games I’m getting 1.002/52 to 1.005/52. So I fancy my calculations are confirmed, the numbers are consistent with 1.00324387034586/52 (but I’m biased), but have pretty well killed 1/52. I’m 100% confident that the basic idea (post 75) is correct. My only doubts are regards the exact probabilities, but they’re not serious doubts.

    NB I wasn’t paying enough attention when writing the proggy, #trials = #games, I didn’t need both variables. But I’m not going to stop the proggy to fix it. But I’ll update the posted code.

    Having done that I find a sin – I used Randomize in the RandomizeArray. Again I won’t stop the proggy for that. It’ll be gone if I update the source code again.

  85. 85. Chris Said:

    I’ve updated the source, mainly to add comments.

    I also stopped the proggy as I could see the values were more or less meandering between about 1.001/52 and 1.005/52

    Stacked Deck MC

  86. 86. Chris Said:

    I’m sorry about this. But I’ve just updated the source again.

    Version 4: Added well-known array shuffler
    Version 5: Better random number generator

    I’m going to leave it running tonight. I’ve had some really daft results, like prob < 1/52. But It’s starting to look sensible again.

  87. 87. Chris Said:

    Aargh. I’ve been a real nit, so version 6 of the proggy is now up. I’d goofed ShuffleArray. I’ve only been running it for a short while since fixing it, but the nuumbers look consistent with 1.00324/52 after 400 000 games.

    I am playing with a variation of the problem with the hope to either make it possible to play every possible game and/or to make the 1.00324 be larger.

    I think I’ll be going with 15 cards per deck, comprising 3 suites of 5 values and so three of a kind (toak), 3 players with 4 cards per hand. That gives just under 16 million possible games and the 1.00324/52 becomes 1.07619/15. The other proposed probability of 1/52 becomes 1/15.

  88. 88. Chris Said:

    I’ve no idea what’s going on, but the simulator now suggests 1/52 (or less!) after 1.5 million games. So I’m giving up on the full simulation up and changing the problem a bit.

    Due to advanced programming considerations, I’ve up issued the source code to version 7.

    WARNING (after post 91). The calculations have incorrectlly assumed mutually exclusive deals. But the result is nearly right.

    New problem: 3 players, 4 cards/player, 3 suites of 5 cards and three of a kind. So the deck has 15 cards.

    Refer to post 76. I’m only going to summarise results here.
    Now have e.g. C[15,4,4,4] = 15 765 750 ‘the number of possible deals

    P[12,1,4,4] = 4/455, P[9,1,1,4] = 4/25025, P[6,1,1,1] = 4/525525
    So the at least 1,2,3 toak(s) to the table probabilities are:
    pt(1+) = 1! C(3,1) C(5,1) P[12,1,4,4] = 12/91
    pt(2+) = 2! C(3,2) C(5,2) P[9,1,1,4] = 48/5005
    pt(3) = 3! C(3,3) C(5,3) P[6,1,1,1] = 16/35035, p(3+) = p(3)

    The exactly 1,2,3 (absolute) probabilities of a toak being dealt are:
    pa(1) = pt(2+) – pt(1+) = 612/5005
    pa(2) = pt(3) – pt(2+) = 64/7007
    pa(3) = pt(3)= 16/35035

    The exactly 1,2,3 relative probabilities of a toak being dealt are:
    p(1) = pa(1)/pt(1+) = 51/55
    p(2) = pa(2)/pt(1+) = 16/231
    p(3) = pa(3)/pt(1+) = 4/1155

    And so the probability of Charlie winning because he was dealt aces is:
    (p(1) + 2p(2) + 3p(3))/15 = (113/105)/15 ≈ 1.07619047619048/15

    I’ll be posting new Monte Carlo code as soon as I’ve written it. If that doesn’t do it, I’ll be back to the drawing board.

  89. 89. Chris Said:

    Here’s the latest code: Stacked Deck MC

    It whizzes along. I got 1.073832/15 after 10 million games, phew!

    Update: 1.074689 after 100 million games.

    I’m now going to see if I can simulate every possible game. But I might be a while.

  90. 90. Chris Said:

    I have found a serious error in my logic. I’m not quite sure how to fix it. Most of the probabilities I’ve given are wrong. The only one that is correct is when every player has an Noak hand. Fortunately, with the posted problem, the 1.0032… is very nearly correct, i.e. the probability is around 1.0032/52. The error only becomes obvious with e.g. 2 players, 3 cards/hand, 2 suits of 4 cards.

    I have made major changes to the code: Stacked Deck MC
    ——-
    Later. I’ve almost fixed it. I’ve got a draft write up and currently am testing – looking very good though :)

  91. 91. Chris Said:

    Enjoy. Here’s my latest analysis. Barring silly errors, I’m 100% confident that I have finally got it right. I regret that it’s difficult to present a more “algebraic” solution here – I tried, but it made for very hard reading, so I edited it out. It turns out that it’s easy to inspect the final equations and deduce the algebaraic form for the general case.

    EDIT (10 June 2013): I’ve completely reworked the solution in post 94 – you may as well skip straight there.

    I will, no doubt, be tarting this comment up over the next few days. I’ll also publish some other results that will be easier to verify with the Monte Carlo program: Stacked Deck MC I’ll also re-edit some of my previous posts so that future visitors don’t waste too much time reading bilge.

    This analysis is in three phases. The first phase is to define (and calculate) probabilities for some precisely defined deals. The second phase is to define probabilities for exactly 0,1,2,3 or 4 oaks (of any type) being dealt to the table. The third phase is to calculate the probability of Charlie winning.

    Preamble: Using the generalised combinatorial function
    C[n,a,b,c,d] = n!/((n-a-b-c-d)! a! b! c! d!) and it’s obvious extensions.
    Define p11 = C[48,3]/C[52,7], p22 = C[44,3,3]/C[52,7,7],
    p33 = C[40,3,3,3]C[52,7,7,7], p44 = C[36,3,3,3,3]/C[52,7,7,7,7] as before.

    The probability of a poak (e.g. 4 aces) being dealt is #players * p11 =>
    4p11 = 4/7735 ≈ 0.000517129928894635

    For definiteness (and to make the rest of this analysis easier to follow, I arbitrarily, but definitely, associate p11 with dealing aces to player 1. I associate p22 with aces to player 1, 2’s to player 2. p33 is as p22, but also 3’s to player 3. p44 is as p33, but also 4’s to player 4.

    Phase 1: p11, p22 and p33 include cases where oak(s) may have be dealt to the non-specified player(s). I hadn’t properly considered the full consequences of that in my previous analyses – my bad. The problem was that the various probabilities I was playing with weren’t for mutually exclusive situations. By introducing very precisely defined cases, I can make the various probabilities be for mutually exclusive cases, and so it’s then OK to add and subtract them. In the cases referred to by p44, that’s not a problem – all the players have been specified and there is no way for another oak to have been dealt. Define pe44 = p44 as the probability that exactly 4 poaks have been dealt to a particular 4 players (i.e. the same poaks to the same players that p44 implied).

    For the case corresponding to p33, we require that e.g. player 4 does not get an oak. There are 13-3 = 10 oaks that he could have been dealt. So we must subtract 10pe44 from p33 to get pe33 = p33 -10pe44, where pe33 is the probability of dealing exactly 3 poaks (again, each poak is to a particular player).

    For the case corresponding to pe22, we have 13-2 = 11 oaks that could have been dealt to e.g. players 3 and 4. So, to get pe22 we must knock off all cases where players 3 and 4 could get oaks. Consider exactly one extra oak having been dealt. There’s 11 possible oaks and 2 possible players, so that’s 22 ways of doing it. So we knock 22pe33 off. If exactly 2 extra oaks were dealt, then we have 11*10 = 110 ways of doing that, so knock a furrther 110pe44 off p22. So pe22 = p22 – 22pe33 – 110pe44.

    For the case corresponding to pe11. We must knock off all the cases where any combination of oaks to the other players are dealt. There are 13-1 = 12 oaks available. For exactly one of players 2,3 or 4 getting an oak there are 3*12 = 36 ways that can be done, so knock 36pe22 off p11. For a particular two of the three (non-particular :~)) players (e.g. 2 and 3) to get an oak, there are 12*11 = 132 ways of that happening. But we could have chosen players 2 and 4, or 3 and 4 => 3*132 = 396 ways altogether, so knock 396pe33 off p11. There are 12*11*10 = 1320 ways that they all three could have got an oak. Altogether pe11 = p11 – 36pe22 – 396pe33 – 1320pe44. Here endeth phase 1.

    Phase 2: Let pe1, pe2, pe3, pe4 be the probabilities of exactly 1, 2, 3 and 4 oaks being dealt – regardless of what the oak is or which player gets it.

    pe4 = 4! C[4,4] C[13,4] pe44 ≈ 0.000 000 000 039 402 264 740 857 420 306
    pe3 = 3! C[4,3] C[13,3] pe33 ≈ 0.000 000 040 996 367 794 373 251 939 663
    pe2 = 2! Cl[4,2]Cl[13,2] pe22 ≈ 0.000 021 643 112 840 7
    pe1 = 1! C[4,1] C[13,1] pe11 ≈ 0.006 679 279 703 236 293 605 636 9
    pe0 = 1 – (pe1+pe2+pe3+pe4) ≈ 0.993299036148152889074244752067

    Phase 3: I pinched this straight from my post 75. The probability of Charlie winning with 4 Aces, given that at least one four of a kind was dealt is:
    ((pe1+2pe2+3pe3+4pe4)/(pe1+pe2+pe3+pe4))/52 = (209005603404/208330175245)/52) ≈ 1.00324210430969/52.

    As you can see, this is very close to the erroneous 1.00324387034586/52.

  92. 92. Chris Said:

    Here’s some theoretical results for checking with the Monte Carlo program.

    For 2 players, 3 cards per hand, two of a kind from a deck with 2 suits of 5 cards per suit, I get:
    Prob of Charlie winning ≈ 1.27272727272727/10
    Prob of aces ≈ 0.133333333333333
    pe0 ≈ 0.476190476190476190476190476190
    pe1 ≈ 0.380952380952380952380952380952
    pe2 ≈ 0.142857142857142857142857142857

    For 2 players, 3 cards per hand, two of a kind from a deck with 2 suits of 4 cards per suit, I get:
    Prob of Charlie winning ≈ 1.42857142857143/8
    Prob of aces ≈ 0.214285714285714
    pe0 = 0.4
    pe1 ≈ 0.342857142857142857142857142857
    pe2 ≈ 0.257142857142857142857142857143

    For 3 players, 4 cards per hand, three of a kind from a deck with 3 suits of 5 cards per suit, I get:
    Prob of Charlie winning ≈ 1.07441860465116/15
    prob aces ≈ 0.0263736263736264
    pe0 ≈ 0.877265591551305837020122734408
    pe1 ≈ 0.114057371200228343085485942629
    pe2 ≈ 0.008220351077493934636791779649
    pe3 ≈ 0.000456686170971885257599543314

    Thanks for the problem DP. That’s got to be the most evil set of calculations and the longest code I’ve done in quite a while.

  93. 93. vrinda Said:

    i think that there are 17,696 cards left.

  94. 94. Chris Said:

    I might tart this up a bit. But I doubt there’ll be significant changes.

    I will post (via a link) the Mathematica code (with some results). You should be able to understand it. It has the advantage that number of players, number of a kind, number of suits in the pack and number of cards in a suit are all variables.

    FWIW I’ve updated the Monte-Carlo code: Stacked Deck MC. That was mainly for my own sanity. I’ve only added some more statistics for display.

    I will be writing a permutations based version (soon). It will give exact results.

    I’ve made some startling discoveries – but I’ve got used to them. My previous interpretation of many of the probabilities was hopelessly wrong. In fact many of them weren’t probabilities that I can recognise as such.

    I shall use foak for “four of a kind” and pfoak for a “particular foak” e.g. 4 Aces is a pfoak. I will use C(n,a,b,…) = n!/((n-a-b-…)! a! b! …) and that is a generalisation of the usual combinations function. I’ll also use pplayer for particular player.

    Consider the the situation when a pplayer is dealt a pfoak. There are
    C(52-4,7-4,7,7,7) ways of dealing that. There are C(52,7,7,7,7) possible deals altogether. Define Qp(1) as the ratio C(52-4,7-4,7,7,7)/C(52,7,7,7,7) = 1/7735. See post 7 for an explanation of why C(52-4,7-4,7,7,7) is the number of ways of dealing a pfoak to a pplayer. If 2 pfoaks are dealt to 2 pplayers, e.g. Queens to A and Kings to B, then we get Qp(2) = C(52-8,7-4,7-4,7,7)/C(52,7,7,7,7).

    The pattern for any number of players should be clear. I won’t show the boring (and trivial) details, but it is the case that those ratios can be conveniently written as Qp(k) = ((52-4k)!/52!)(7!/3!)k. The 3, 4 and 7 are because we are considering 4 of a kind and a 7 card hand. The 52 and 13 is the cards per deck and the cards per suit. The 4 is also the number of suits in a deck. I’ll take care to distinguish when 4 is the number of suits and when it is the number of players.

    Qp(k) is the normalised (i.e. per deal) number of ways of dealing k pfoaks to k pplayers. Other players may also get a foak. Let Pp(k) be the number of ways (per deal) of getting exactly the specified hand(s). Then we see that Qp(k) ≥ Pp(k). The equality is only taken when k = #players.

    Define Qa(k) as the normalised number of ways of dealing any k foaks to any k players. There are C(4,k) ways of choosing the k players. For each of those ways there are 13!/(13-k)! = C(13,k) k! ways of selecting the foaks. Altogether that means that Qa(k) = C(4,k) C(13,k) k! Qp(k). The 4 is the number of players. As before, Qa(k) doesn’t consider the cases where an unspecified player gets a foak.

    It seems to me that Qp(k) is an intelligible quantity. I cannot say that it is immediately apparent that Qa(k) is – but it turns out that it is useful.

    I’m now going to cheat a bit. I have discovered that Qa(1) is the average number of foaks per deal. I also found that Qa(1) – Qa(2) + Qa(3) – Qa(4) is the probability of dealing at least one foak (and so having a game) = the number of times at least one foak is dealt per deal. Qa(1) / (Qa(1) – Qa(2) + Qa(3) – Qa(4)) is therefore the average number of foaks per game = N say.

    As Qa(i) >> Qa(i+1), N is a bit larger than 1. In fact
    N = 209005603404 / 208330175245 = 1.00324210430968862021128858…

    1/13 of those foaks will be Aces, and 1/4 of those will go to Charlie. So Charlie’s probability of winning with Aces is ≈ 1.0032421043097 * 1/52. Obviously, that is everyone else’s probability of doing that.

    Sadly, I can’t quite get my head around to seeing why e.g. Qa(1) is the average number of foaks per deal.

    Define Pp(k) to be the probabiility of dealing exactly k pfoaks to k pplayers. If k = 4 then there cannot be another player to receive a foak, and so Qp(4) = Pp(4). Now consider the case where 3 pfoaks have been dealt to 3 pplayers. Qp(3) must include the case where the last man hasn’t got a foak, the number of times that happens is Pp(3) and the cases where the last man has got any one of the remaining 10 pfoaks. Each of those cases happens Pp(4) times per deal. So Qp(3) = Pp(3) + 10 Pp(4). So Pp(3) = Qp(3) – 10 Pp(4). That’s the warm up round.

    For any arbitrary k it should now be pretty obvious that
    Pp(k) = Qp(k) – Sum(n=k+1 to #players, (#ways to add n-k foaks)*Pp(n)) =>
    Pp(k) = Qp(k) – Sum[n=k+1 to 4, C(4-k,n-k) C(13-k,n-k) (n - k)! Pp(n)]
    where the 4’s are the number of players.

    Unlike Qa(k), Pa(k) has a simple physical interpretation. e.g. the probabilty of dealing at least k foaks = Sum(n = k to #players, Pa(k)). The probability of dealing e.g. exactly an Ace foak only is Pa(1)/13, etc.

    I have found (by the inspired use of trial and error) that:
    Pa(k+) = Sum(n=k to #players, (-1)^(n+k) C(n-1,k-1) Qa(n))
    Pa[0+) = Qa(0)
    Pa(1+) = Qa(1) – Qa(2) + Qa(3) – Qa(4)
    Pa(2+) = Qa(2) – 2 Qa(3) + 3 Qa(4)
    Pa(3+) = Qa(3) – 3 Qa(4)
    Pa(4+) = Qa(4) = Pa(4) of course.

    The full patterns don’t show as there are so few cases. We can use that to get
    Pa(0) = Pa(0+) – Pa(1+) = Qa(0) – Qa(1) + Qa(2) – Qa(3) + Qa(4)
    Pa(1) = Pa(1+) – Pa(2+) = Qa(1) – 2 Qa(2) + 3 Qa(3) – 4 Qa(4)
    Pa(2) = Pa(2+) – Pa(3+) = Qa(2) – 3 Qa(3) + 6Qa(4)
    Pa(3) = Pa(3+) – Pa(4+) = Qa(3) – 4 Qa(4)
    Pa(4) = Pa(4+) – Pa(5+) = Qa(4) I cheated a bit there

    These formulae scream out that at least some of them should could be written down on inspection by employing the inclusion-exclusion principle.
    ——
    The reason I re-examined this is partly because I now have a permutation generator that I want to try out (because that should give the exact answer using exhaustive simulation), and partly because a friend was interested in how you calculate the probabilities of dealing cards. When I recover from effort of writing this post, I’ll knock up an exact simulation proggy. I won’t replace the one previously linked.
    ——
    Just for a laugh I checked on the prime factors of 208 330 175 245 and found it is
    15*41 666 035 049 (that’s over 41 billion). I tried quite a lot of different combinations of players, cards per suit etc., and found it was very common for the denominator (but not the numerator) to have one or two very large prime factors.
    e.g.’s 273 369 696 845 122 493 891 599 (that’s 273 quintillion) – I don’t remember the settings for that.

    I got 93 090 706 895 526 742 621 774 978 335 343 (that’s nearly 10^32) – that’s with 11 players, 7 cards/hand, 4 of a kind, 18 cards/suit. Using 11 players, 7 cards/hand, 6 of a kind (6 suits) and 20 cards/suit I got
    2939202688335238316215319589213428558988005559317 = 2.9… *10^48.

  95. 95. Chris Said:

    Rather than completely reworking the last post, I’ll just add this one.
    Recap Qa(k) = C(4,k)C(13,k) k! Qp(k) and Pa(k) = C(4,k)C(13,k) k! Pp(k)

    Qp(1) is the number of times we deal exactly 1 pfoak to a pplayer, plus the number of times we also deal an extra foak to any of the other players, plus the number of times we also deal 2 extra foaks to any of the other players, etc. NB by number of times, I mean number of times per deal (on average).

    Let’s see what Qp(1) is. For the case of no extra foaks, we simply have Pp(1). For the case of one extra foak, we could deal any of 12 foaks to B,C or D. For the case of 2 extra foaks we could deal any pair of the 12 foaks to any pair of B,C,D. For the 3 extra foaks, we can deal any three of the 12 foaks to any 3 of three of B,C,D. So

    Qp(1) = Sum(n=1 to 4, C(3,n-1) C(12,n-1) (n-1)! Pp(n))
    NB in case your wondering where the Pp(1) has gone, note that n=1 =>
    C(3,0)C(12,0) 0! Pp(1) = Pp(1)

    Using Qa(1) = 52 Qp(1) and Pa(n) = C(4,n)C(13,n) n! Pp(n) =>
    Qa(1) = 52*(Sum(n=1 to 4, C(3,n-1) C(12,n-1) (n-1)! Pa(n)/(C(4,n) C(13,n) n!))
    = 52*(Sum(n=1 to 4, Pa(n) n/52)
    => Qa(1) = Pa(1) + 2*Pa(2) + 3*Pa(3) + 4*Pa(4)
    So Qa(1) is the average number of foaks per deal as previously claimed.

    Emboldened by that success, I’ll go straight for

    Qa(k) = C(4,k)C(13,k)k!
    * Sum(n=k to 4,C(4-k,n-k)C(13-k,n-k) (n-k)! Pa(n)/(C(4,n) C(13,n) n!))

    => Qa(k) = Sum(n=k to 4, C(n,k) Pa(n))

    Qa(0) = Pa(0) + Pa(1) + Pa(2) +Pa(3) + Pa(4) = 1
    Qa(1) = Pa(1) + 2 Pa(2) + 3 Pa(3) + 4 Pa(4) = P average
    Qa(2) = Pa(2) + 3 Pa(3) + 6 Pa(4)
    Qa(3) = Pa(3) + 4 Pa(4)
    Qa(4) = Pa(4)

    that lot can easily be solved to give (NB Qa(0) = 1)
    Pa(0) = Qa(0) – Qa(1) + Qa(2) – Qa(3) + Qa(4)
    Pa(1) = Qa(1) – 2 Qa(2) + 3 Qa(3) – 4 Qa(4)
    Pa(2) = Qa(2) – 3 Qa(3) + 6 Qa(4)
    Pa(3) = Qa(3) – 4 Qa(4)
    Pa(4) = Qa(4)

    NB the coefficients are the same as on Pascal’s triangle.

    Pa(0+) = Qa(0) = 1
    Pa(1+) = Qa(1) – Qa(2) + Qa(3) – Qa(4)
    Pa(2+) = Qa(2) – 2 Qa(3) + 2 Qa(4)
    Pa(3+) = Qa(3) – 3 Qa(4)
    Pa(4+) = Qa(4) = Pa(4)

  96. 96. Chris Said:

    As threatened, I’ve finally written a permutations generator version. I’ve also, yet again, updated the Monte Carlo version. Here are the links:

    Stacked Deck MC and Stacked Deck PG

    I’m not going to bother posting the Mathematica code.

    Needless to say, I’ve found another bewildering problem. It seems that there can be more combinations for the cards being dealt, than there are ways of shuffling a deck. My brain is too exhausted to think of the way out of this paradox. The PG version of the code has a couple of lines to let you see for yourself.

    Other than that, I think I’m just about to put this page to bed.

  97. 97. Chris Said:

    I think I know how my “paradox” arises. I’ll focus on the Kings for the purpose of discussion. Originally, when analysing the possible deals, the suits of the cards were implictly being regarded as significant. e.g. I had expressions like P(48,7-4,7,7,7). i.e. having pulled out the foak from the deck, the 48 remaing cards were being treated as distinct. However, when I implemented the NextPerm function, I didn’t make the Kings distinct from each other. If my brain is handling that right, that would save a factor of 4!^13 = 9.2…*10^155 deals – even if I’m wrong about that number, I’m right in that an enormous factor will be involved. The counting logic never cared about the suits.

    I instinctively wrote the function that way, as it, both, makes the code easier to write and it very substantially reduces the number of deals required.

    I’m not going to try to modify the original analysis to deal with indistinct suits, as I’m now satisfied that the source of the paradox has been identified.

    I noticed the paradox when I was trying to speed up the simulation. After a deal, typically, there will be cards left in the deck. Many of the permutations will only be permuting these “bottom” cards. While that is happening, all the deals will give the the same cards to the players. I wanted to short circuit that. I naively assumed that, by some supposed symmetry, that I could make the NextPerm function, automatically skip those perms, and only return those that affected the deal. When I tried it, the results were completely wrong.

    However, the idea is good. What I need to do is to recognise when only the bottom cards are shuffled (that’s easy), then calculate how many shuffles that affects, and return that info to the main routine. I also then would put the bottom cards into the state where the next shuffle does affect the deal.

    I might yet do that. I feel that it is in the spirit that a simulator should not actually know the maths for the real problem being simulated. It might make it possible to simulate using a full deck of 52 cards in less than a billion times the current age of the Universe. At least, It could substantially shorten the time required to do a simulation.

    e.g. if there are 3 distinct cards at the bottom of the deck, and if they are in ascending order e.g. X678, where X is in the part of the deck that will be dealt, then there will be 6 permutations, before X (or higher) will be involved. The perms are X678, X687,X768,X786,X867,X876. So I could pass back the info that there are 6 equivalent perms. I’d also reverse the sequence to get X876 in readiness for the next call to NextPerm.

    The part of the code that analyses the deals can use this to instantly multiply the appropriate statistics by 6 (in the case of my example).

    If the bottom of the deck was e.g. X667 the perms are: X667,X676,X766. So I’d return 3 as the degeneracy factor, and reverse X667 to X766.

    More generally if there are a,b,c,… duplicates of cards of type A,B,C,… the number of permutations (or should I call tha combinations?) is (a+b+c+…)!/(a! b! c! …). So this is all looking simple enough in principle.

    To see if this really is worthwhile, consider the original problem. After dealing 4*7 = 28 cards, there are 24 left in the deck (i.e. the bottom cards). In one extreem case there are 24! = 620,448,401,733,239,439,360,000 (approx 6.2 x 10^23) deals that could be skipped. The other extreme is (4+4+4+4+4+4)!/(4! 4! 4! 4! 4! 4!) = 24!/(4! ^ 6) = 3,246,670,537,110,000 (approx 3.2 x 10^15). Sadly, it still leaves a lot of deals (that’s an understatment). There will still be about 4 135 312 833 817 733 568 000 000 = 4.1*10^24 deals to do. The age of the Universe is thought to be about 4.4*10^17 seconds. So I still can’t do the full simulation for the original problem.

    I think I’ll implement this stuff as it would a nice programming excercise and would be a permanent addition to my library.

  98. 98. Chris Said:

    I’ve now added my accelerator technology to the PG version of the code. I’ve also improved the running statistics info (both PG and MC versions). The PG version also displays the theoretical results at the end of the run. It also displays benchmark data.

    The PG version still only handles small deck sizes, but is a big improvement on the previous version.

    The PG version also has some very useful utility functions, so you might want to grab it for that reason alone. They are quick and dirty only, but they do the job.

    Stacked Deck MC and Stacked Deck PG

    Warning. With the PG version, the main result, i.e. the probability of Charlie winning will be miles out until the full run has completed. Most of the other statistics get close quite quickly.

  99. 99. Chris Said:

    I forgot to say that the PG simulator confirms the theory.

    For the posted problem, the probability of Charlie winning with Aces is:

    (209005603404/208330175245)/52 ≈ 1.00324210430968862/52

  100. 100. Chris Said:

    Just a few more posts and the man in room is moved closer to the pit in hell from whence it came.

  101. 101. DP Said:

    I just realized that I hadn’t responded on here for almost 20 responses. I’m ok with this one taking over the ‘man in room’ problem, and am also ok with posting less than 10% of the content.
    I intended to come back to see if we ever reached a conclusion, since there was a lot of card dealing simulation happening and a lot of stats thrown out there.
    I see that in post #99 we have a ‘confirmation’ of sorts. Also, a lot of people guessed at 1/52, which appeared to be close (but not quite right).
    Apparently this stuff was all over my head, so maybe I shouldn’t have been the one to post it. Oh well, it kept several people busy for a week, and others two and a half years.

  102. 102. Chris Said:

    Hi DP. Funnily enough, when searching for new problems to post, I found a (to me) surprisingly simple way of calculating the probability of e.g. dealing exactly one pair (to a given player). I might yet add another way of tackling the analysis.

Post a reply




PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\ext\php_mssql.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\ext\php_pdo_mssql.dll' - The specified module could not be found. in Unknown on line 0