By "run", I just mean five (or more) cards in a row of the same suit.
I don't mean "run" the way it is normally used in card games like
rummy. What I mean is what a poker player would call a flush.
Bob H
P.S. This is an extension of an easier problem I posted to
rec.puzzles back on Jul/11/2003 (which was solved by Robert Israel).
If you can't find it, use http://tinyurl.com/ydql3km . I'm not sure
that finding that one will help much though.
You'd think this would be immediately easy to Google,
but you'll get drowned in Texas Hold'em tables if you do.
You have to specify _draw_ poker, specifically with a 52-card
deck. The odds are 508 to 1 against a flush.
Now, going back to your first paragraph, if you mean
not just the odds of being dealt a flush, but the odds that
anywhere in a laid-down deck five cards will form a flush
_regardless_ of whether those five cards in the sequence
would be dealt to a single person, that's a whole 'nother
question.
That other question is what I have in mind. I see, though, that my
subject line is easy to interpret the way you did. I am re-initiating
this thread with a better subject line: "Five cards in a row, same
suit".
Bob H
You can calculate that from the previous answer. If the probability of 5
cards being the same suit is P, then the probability of 5 cards not
being the same suit is (1-P). In a 52-card deck there are 48 sets of
5-cards-in-a-row, so the probability of no flush is (1-P)^48. So the
probability of a flush is 1-((1-P)^48).
--
Mike Williams
Gentleman of Leisure
Multiplying probabilities only works for *independent* events,
but these aren't quite so.
Another way that almost works is to add probabilities:
prob of flush in any of 48 points = 48*P
(which corresponds to the first term in the expansion
of your expression).
But adding probabilities only works for *exclusive* events.
Either of these ways can give an approximate answer, especially
if adjusted (e.g. subtract probability of 6-flush from
48*P since 6-flushes are counted twice), but I think Bob
is looking for a simple *exact* formula.
James Dow Allen
xxx ? fabulous.pedi ???
Oops!! Now rec.puzzlers know my secret! At 1:14 Google time
I was hacked into the fabulous.pedi gmail account. Google,
bless its wonderful do-no-evil heart, allows only one
avatar per connection, so was friendly enough to silently
change my Google Groups Identity.
I suppose fabulous.pedi will now be getting lots of spam.
Serves it right for using such an easy-to-guess
password.
James Dow Allen
?????
Me too. Don't understand your numericals.
My guess is
prob(at least one straight-flush)
= 0.0000123126173546
= 1 chance in about 81217
Not only that, but a deck might contain more than one separate 5-flush
(it could have as many as 8), and these are not independent. In fact,
having one flush slightly increases the chance of having another one.
The five cards lumped together in the first flush don't block other
flushes as well as they would if they weren't lumped together.
> but I think Bob is looking for a simple *exact* formula.
Emphasis on exact. I think a simple formula would be an amazing
accomplishment. I think exhaustive enumeration is out, since there
are 10^27 ways to shuffle the deck (ignoring suits). I do have the
answer though (assuming I'm correct).
For a similar problem that can be solved by just listing all the
combinations, try a deck of 21 cards (3 suits of A..7), and look for 3-
flushes.
Bob H
There are 48 positions the flush could be in.
Looking at the first five cards 1-5 we have :
1st card we have a 1 in 1 chance as it doesn't matter what the suit is.
2nd card has a 12 in 51 chance
3rd card has an 11 in 50 chance
4th card has an 10 in 49 chance
5th card has an 9 in 48 chance
So, we have 1x12/51x11/50x10/49x9/48 = 0.00198% or 1 in 504.848484
Now as far as I can see the chance of getting a flush in the cards 2-6 is
exactly the same.
Therefore we have 48x0.00198
= 0.095%
or 1 in 10.51767676
Now you can all tell me where I've gone wrong :o)
Applying the same logic to the question "chance of deck contains a
pair (two cards in a row like 66 or KK)?"
There are 51 positions the pair could be in.
Looking at first two cards we have :
1st card we have a 1 in 1 chance as it doesn't matter what the face
is.
2nd card has a 3 in 51 chance
So, we have 1x3/51 = 1/17
Now as far as I can see the chance of getting a pair in the cards 2-3
is exactly the same.
Therefore we have probability 51x1/17 = 3. A proability of 3.
> Now you can all tell me where I've gone wrong :o)
Mainly you ignored having a flush in one position and having a flush
in another aren't independent.
Signed, The Wizzi Fig
You can't multiply probabilities like that.
Suppose I do 2 flips.
The probability of getting heads on the first flip is 1/2
The chance of getting heads on the second flip is the same.
So the chance of getting heads in two flips is 1/2 * 2 = 1
The correct way to get 'the probability of success with N tries':
If the probability for success in one try is p, the probability
for failure in one try is 1-p, the probability for two failures
in a row is (1-p)*(1-p) and the probability for all failures
in N tries is (1-p)^N, so the probability for at least one success
is 1-(1-p)^N
Ignoring the fact that the probabilities aren't independent,
with a chance of 33/16660, repeated 48 times, you get
1-(1-(33/16660))^48 =~ 0.09078, or about 9%
That's not that much off from your 9.5%, which shows that with
small probabilities just adding them up isn't really terrible,
for a ballpark estimate.
Martingale, anyone ?
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
OK, here's what I get for exhaustive enumeration of 3 suits of 7. R
is the maximum length run of cards in the same suit. The first table
entry is verifiable as it agrees with Sloane's sequence A110706.
(view in a monospace font)
--+------------------------------+-------------------------------+
N | p(R=N) | p(R>=N) |
--+---------------------+--------+---------------------+---------+
1 | 339720/399072960 | 0.09% | 399072960/399072960 | 100.00% |
2 | 108266688/399072960 | 27.13% | 398733240/399072960 | 99.91% |
3 | 198384312/399072960 | 49.71% | 290466552/399072960 | 72.79% |
4 | 74192760/399072960 | 18.59% | 92082240/399072960 | 23.07% |
5 | 15592110/399072960 | 3.91% | 17889480/399072960 | 4.48% |
6 | 2143140/399072960 | 0.54% | 2297370/399072960 | 0.58% |
7 | 154230/399072960 | 0.04% | 154230/399072960 | 0.04% |
--+---------------------+--------+---------------------+---------+
I'm posting that because that was my main test case for comparison to
my recurrence-based solution. If someone else wants to try their hand
at it, it gives a point of comparison and the problem is small enough
that it is tractable.
The recurrence is best described by example. First, I don't work with
probabilities, but I count the number of deck orders (or more
conveniently strings) that contain a run of the desired length, or
longer. For 3 suits of 7, run of 4, the end state of the recurrence
looks like this:
N(7,7,7) = 3*N(7,7,[6]) + 3*N(7,7,[5]) + 3*M(7,7,4)
Those three summands correspond to whether the first run is 1, 2, or 3
cards. The state (7,7,7) means we have three suits of 7 and any of
them can be used for the first run. (7,7,[6]) means we have two suits
of 7 and one of 6. The brackets around the 6 mean that suit cannot be
used for the first run (in what remains of the deck). The
multiplication by three is the result of the fact that we have three
identically sized suits in the state we're expanding.
The third summand has M() instead of N(). M simply counts all
possible decks. That summand corresponds to the first run being 3
cards of the same suit, which is enough (in fact the run might be
longer). Any ordering of the remaining cards doesn't matter. M can
be computed directly from the binomial formula, e.g. M(7,7,4) = 18!/7!
7!4! .
Expanding (7,7,[5]), I would have
N(7,7,[5]) = 2*N(7,5,[6]) + 2*N(7,5,[5]) + 2*M(7,5,4)
And expanding (7,5,[6]), I would have
N(7,5,[6]) = N(6,5,[6]) + N(6,5,[5]) + M(6,5,4) + N(7,6,[4]) + N
(7,6,[3]) + M(7,6,2)
The first three summands correspond to the first run being 1, 2 or 3
cards from the suit of size 7; the other three summands correspond to
the same but for the suit of size 5. There are no longer any
multipliers because the usable suits in this state have different
sizes.
There is one other special case not shown in the examples above. For
any state with all three numbers (suit sizes) less than 3, N for that
state is 0. These are the initial state or boundary conditions.
For the original problem, the recurrence is basically the same, but
with more summands because the desired run length is 5 and the number
of suits is 4. The final state is (13,13,13,13). It turns out that
there are only about 7000 non-boundary states that contribute to the
final state. In other words, one only has to compute the recurrence
over about 7,000 states. And it helps if you are using a language
that supports large integers, since they can get quite large.
Bob H
Of course both the numbers are over estimates (they are high).
Bob H
Mark Tilford has posted a lisp program to compute that, over in the
other thread I created for this same question (in this same
newsgroup). His program uses a similar but different recurrence, and
gives the same answer.
Similar to the table I posted the other day for the 3 suits of 7
problem, the table below shows the answer for a regular deck with 4
suits of 13, for all run lengths.
Thanks for your contributions and/or interest,
Bob H
(view with a monospace font)
+---------------------------------------------------------------------------------------------
+
| N(R|13/13/13/13)
denominator=53644737765488792839237440000
|
---+-------------------------------+---------
+-------------------------------+----------+--------+
R | #(N=R) | p(N=R) | #
(N>=R) | p(N>=R) |
---+-------------------------------+---------
+-------------------------------+----------+--------+
1 | 63394531038905867912088 | 0.000% |
53644737765488792839237440000 | 100.000% |
2 | 5605232080035757075753522464 | 10.449% |
53644674370957753933369527912 | 100.000% |
3 | 29354985769561449095265479424 | 54.721% |
48039442290921996857616005448 | 89.551% |
4 | 14602306702547362140170972424 | 27.220% |
18684456521360547762350526024 | 34.830% |
5 | 3364606470831166233967034424 | 6.272% |
4082149818813185622179553600 | 7.610% |
6 | 607626493379958028764684552 | 1.133% |
717543347982019388212519176 | 1.338% |
7 | 95242071441561454862464320 | 0.178% |
109916854602061359447834624 | 0.205% |
8 | 13006791411877336512386304 | 0.024% |
14674783160499904585370304 | 0.027% |
9 | 1512823433267166394953600 | 0.003% |
1667991748622568072984000 | 0.003% |
10 | 144084797835786599944320 | 0.000% |
155168315355401678030400 | 0.000% |
11 | 10542857730303666536664 | 0.000% |
11083517519615078086080 | 0.000% |
12 | 527143293666930033600 | 0.000% |
540659789311411549416 | 0.000% |
13 | 13516495644481515816 | 0.000% |
13516495644481515816 | 0.000% |
---+-------------------------------+---------
+-------------------------------+----------+--------+