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

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.

• What runs is an ace permitted to make? (I assume K-A-2 and the like are straight out.) – Brian Tung Nov 12 '16 at 18:48
• We have a $52$-card deck, I guess. So, the number of combinations we can draw is $\binom{52}{N}$. The difficult part is to count the combinations allowing a "meld". – Peter Nov 12 '16 at 18:49
• Do you have the source, or any context for this problem,? The generic case seems very complex to me. – Pieter21 Nov 12 '16 at 19:08
• @BrianTung: this is up to house rules, but I generally prefer to allow K-A-2. – Joshua Frank Nov 12 '16 at 19:53
• @SteveKass: Wow, that's pretty interesting. I would have thought the no-meld odds were lower. Thanks for running the sim. If you post these comments as an answer, I'll accept it. – Joshua Frank Nov 13 '16 at 12:35

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,
Range}];
(* 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, #[] == 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[#[] - #[] &, 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}} *)


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)

• So now I'm wondering: can you prove that there's no closed form solution? How can you know that there's no way to compute it other than by enumerating all the possibilities? – Joshua Frank Nov 12 '16 at 22:10