What is the probability of not having a meld among N cards?

60 Views Asked by At

In rummy type games, a "meld" is either:

  • Three of a kind (e.g. three sevens or three queens, of any suit)
  • A run of three in the same suit (e.g. 3-4-5 of hearts or J-Q-K of clubs)

Suppose you have N cards, drawn randomly from a standard 52 card deck, no jokers. What are the odds that you CANNOT make a meld?

I don't even know how to begin figuring this one out.

2

There are 2 best solutions below

1
On

Given your context, I would say that it can't be calculated easily for the general $N$ case.

Even for $N = 14$, I think you would need a computer to calculate all possible cases, with inclusion/exclusion to prevent duplicate cases.

But since you need a computer anyway, I would just run a series of simulations. E.g. 1000 random drawings, and count the number of cases without melds. (Not sure if we can enumerate all ~2trillion cases https://www.wolframalpha.com/input/?i=52+choose+14 with some smart branch&bounding)

0
On

Numerical calculation suggests that a bit more than $18$% of all $14$-card deals contain no meld. Here’s the annotated Mathematica code I used for the calculation. It’s not particularly efficient or elegant, but I think it’s correct.

deck = Tuples[{Range[4], 
    Range[13]}]; 
(* E.g., {2,11} is the Jack of diamonds *)
(* A "deal" will be a sequence of items from the deck. *)

has3[deal_] :=
  Max[Tally[deal[[All, 2]]][[All, 2]]] >= 3;
(* 3-of-a-kind means at least three {suit, r} items for some r *)

suitRanks[deal_, suit_] := 
  Sort[Union[Select[deal, #[[1]] == suit &][[All, 2]]]];
(* Returns sorted list of card ranks in the deal for a specified suit *)

potentialRuns[suitlist_] := 
  Partition[suitlist, 3, 1, {1, 1}, 
   Catenate[{suitlist, suitlist + 13, suitlist + 26}]];
(* Generates potential 3-runs, with wrapping:
E.g., {2,3,9,11} to {{2,3,9},{3,9,11},{9,11,2+13},{11,2+13,3+13}}.
This is definitely not the cleverest approach. *)

diff[x_] := Map[#[[3]] - #[[1]] &, x]; (* c - a in {a,b,c} *)

potentialRunWidths[x_] := 
 Table[diff[potentialRuns[suitRanks[x, suit]]], {suit, 1, 4}];
(* List of the widths of all the potential runs in each suit of the deal *)

hasRun[x_] := Min[Min /@ potentialRunWidths[x]] == 2;
(* The deal has a run of length 3 if one of the potential run widths is 2 *)

t = Table[
  RandomSample[deck, 14], {i, 1, 10000}];
(* Generate 10000 14-card deals *)

Sort[Tally[Map[hasRun[#] || has3[#] &, t]]]
(* Tally the number of hands that did not/did have a meld.
For example, this was one result: {{False,1829},{True,8171}} *)