**Brian Alspach**

**18 January 2000**

We determine the number of 7-card poker hands.

One of the most popular poker games is 7-card stud. The way hands are ranked is to choose the highest ranked 5-card hand contained amongst the 7 cards. People frequently encounter difficulty in counting 7-card hands because a given set of 7 cards may contain several different types of 5-card hands. This means duplicate counting can be troublesome as can omission of certain hands. The types of 5-card poker hands in decreasing rank are

- straight flush
- 4-of-a-kind
- full house
- flush
- straight
- 3-of-a-kind
- two pairs
- a pair
- high card

The total number of 7-card poker hands is .

We shall count straight flushes using the largest card in the straight flush. This enables us to pick up 6- and 7-card straight flushes. When the largest card in the straight flush is an ace, then the 2 other cards may be any 2 of the 47 remaining cards. This gives us straight flushes in which the largest card is an ace.

If the largest card is any of the remaining 36 possible largest cards in a straight flush, then we may choose any 2 cards other than the immediate successor card of the particular suit. This gives us straight flushes of the second type, and 41,584 straight flushes altogether.

In forming a 4-of-a-kind hand, there are 13 choices for the rank of the quads, 1 choice for the 4 cards of the given rank, and choices for the remaining 3 cards. This implies there are 4-of-a-kind hands.

There are 3 ways to get a full house and we count them separately. One way of obtaining a full house is for the 6-card hand to contain 2 sets of triples and a singleton. There are ways to choose the 2 ranks, 4 ways to choose each of the triples, and 44 ways to choose the singleton. This gives us full houses of this type. A second way of getting a full house is for the 7-card hand to contain a triple and 2 pairs. There are 13 ways to choose the rank of the triple, ways to choose the ranks of the pairs, 4 ways to choose the triple of the given rank, and 6 ways to choose the pairs of each of the given ranks. This produces full house of the second kind. The third way to get a full house is for the 7-card hand to contain a triple, a pair and 2 singletons of distinct ranks. There are 13 choices for the rank of the triple, 12 choices for the rank of the pair, choices for the ranks of the singletons, 4 choices for the triple, 6 choices for the pair, and 4 choices for each of the singletons. We obtain full houses of the last kind. Adding the 3 numbers gives us 3,473,184 full houses.

To count the number of flushes, we first obtain some useful information
on sets of ranks. The number of ways of choosing 7 distinct ranks from
13 is
.
We want to remove the sets of ranks
which include 5 consecutive ranks (that is, we are removing straight
possibilities). There are 8 rank sets of the form
.
Another form to eliminate is
,
where *y* is neither *x*-1 nor *x*+6. If *x* is ace or 9, there
are 6 choices for *y*. If *x* is any of the other 7 possibilities, there
are 5 possibilities for *y*. This produces
sets with 6 consecutive ranks. Finally, the remaining form to eliminate
is
,
where neither *y* nor *z* is allowed to
take on the values *x*-1 or *x*+5. If *x* is either ace or 10, then
*y*,*z* are being chosen from a 7-subset. If *x* is any of the other 8
possible values, then *y*,*z* are being chosen from a 6-set. Hence, the
number of rank sets being excluded in this case is
.
In total, we remove 217 sets of ranks ending up
with 1,499 sets of 7 ranks which do not include 5 consecutive ranks.
Thus, there are
flushes having all 7 cards in the
same suit.

Now suppose we have 6 cards in the same suit. Again there are 1,716
sets of 6 ranks for these cards in the same suit. We must exclude
sets of ranks of the form
of which there
are 9. We also must exclude sets of ranks of the form
,
where *y* is neither *x*-1 nor *x*+5. So if *x* is ace
or 10, *y* can be any of 7 values; whereas, if *x* is any of the other
8 possible values, *y* can be any of 6 values. This excludes 14 + 48
= 62 more sets. Altogether 71 sets have been excluded leaving 1,645
sets of ranks for the 6 suited cards not producing a straight flush.
The remaining card may be any of the 39 cards from the other 3 suits.
This gives us
flushes with 6 suited
cards.

Finally, suppose we have 5 cards in the same suit. The remaining 2 cards cannot possibly give us a hand better than a flush so all we need do here is count flushes with 5 cards in the same suit. There are choices for 5 ranks in the same suit. We must remove the 10 sets of ranks producing straight flushes leaving us with 1,277 sets of ranks. The remaining 2 cards can be any 2 cards from the other 3 suits so that there are choices for them. Then there are flushes of this last type. Adding the numbers of flushes of the 3 types produces 4,047,644 flushes.

We saw above that there are 217 sets of 7 distinct ranks which include
5 consecutive ranks. For any such set of ranks, each card may be any
of 4 cards except we must remove those which correspond to flushes.
There are 4 ways to choose all of them in the same suit. There are
ways to choose 6 of them in the same suit. For 5
of them in the same suit, there are
ways to choose
which 5 will be in the same suit, 4 ways to choose the suit of the 5
cards, and 3 independent choices for the suits of each of the 2 remaining
cards. This gives
choices with 5 in the same
suit. We remove the 844 flushes from the
4^{7} = 16,384 choices of cards
for the given rank set leaving 15,540 choices which produce straights.
We then obtain
straights when the 7-card
hand has 7 distinct ranks.

We now move to hands with 6 distinct ranks. One possible form is
,
where *x* can be any of 9 ranks. The other
possible form is
,
where *y* is neither *x*-1nor *x*+5. When *x* is ace or 10, then there are 7 choices for *y*.
When *x* is between 2 and 9, inclusive, there are 6 choices for *y*.
This implies there are
sets of 6 distinct
ranks corresponding to straights. Note this means there must be a pair
in such a hand. We have to ensure we do not count any flushes.

As we just saw, there are 71 choices for the set of 6 ranks. There
are 6 choices for which rank will have a pair and there are 6 choices
for a pair of that rank. Each of the remaining 5 cards can be chosen
in any of 4 ways. Now we remove flushes. If all 5 cards were chosen
in the same suit, we would have a flush so we remove the 4 ways of
choosing all 5 in the same suit. In addition, we cannot choose 4 of
them in either suit of the pair. There are 5 ways to choose 4 cards
to be in the same suit, 2 choices for that suit and 3 choices for the
suit of the remaining card. So there are
choices which give a flush. This means there are
4^{5} - 34 = 990choices not producing a flush. Hence, there are
straights of this form.

We also can have a set of 5 distinct ranks producing a straight which
means the corresponding 7-card hand must contain either 2 pairs or
3-of-a-kind as well. The set of ranks must have the form
and there are 10 such sets. First we suppose
the hand also contains 3-of-a-kind. There are 5 choices for the rank
of the trips, and 4 choices for trips of that rank. The cards of the
remaining 4 ranks each can be chosen in any of 4 ways. This gives
4^{4} = 256 choices for the 4 cards. We must remove the 3 choices for which
all 4 cards are in the same suit as one of the cards in the 3-of-a-kind.
So we have
straights which also
contain 3-of-a-kind.

Next we suppose the hand also contains 2 pairs. There are choices for the 2 ranks which will be paired. There are 6 choices for each of the pairs giving us 36 ways to choose the 2 pairs. We have to break down these 36 ways of getting 2 pairs because different suit patterns for the pairs allow different possibilities for flushes upon choosing the remaining 3 cards. Now 6 of the ways of getting the 2 pairs have the same suits represented for the 2 pairs, 24 of them have exactly 1 suit in common between the 2 pairs, and 6 of them have no suit in common between the 2 pairs.

There are 4^{3} = 64 choices for the suits of the remaining 3 cards.
In the case of the 6 ways of getting 2 pairs with the same suits, 2
of the 64 choices must be eliminated as they would produce a flush
(straight flush actually). In the case of the 24 ways of getting 2
pairs with exactly 1 suit in common, only 1 of the 64 choices need be
eliminated. When the 2 pairs have no suit in common, all 64 choices
are allowed since a flush is impossible. Altogether we obtain

straights which also contain 2 pairs. Adding all the numbers together gives us 6,180,020 straights.

A hand which is a 3-of-a-kind hand must consist of 5 distinct ranks.
There are
sets of 5 distinct ranks from
which we must remove the 10 sets corresponding to straights. This
leaves 1,277 sets of 5 ranks qualifying for a 3-of-a-kind hand. There
are 5 choices for the rank of the triple and 4 choices for the triple
of the chosen rank. The remaining 4 cards can be assigned any of 4
suits except not all 4 can be in the same suit as the suit of one of
cards of the triple. Thus, the 4 cards may be assigned suits in
4^{4}
-3=253 ways. Thus, we obtain
3-of-a-kind hands.

Next we consider two pairs hands. Such a hand may contain either 3 pairs plus a singleton, or two pairs plus 3 remaining cards of distinct ranks. We evaluate these 2 types of hands separately. If the hand has 3 pairs, there are ways to choose the ranks of the pairs, 6 ways to choose each of the pairs, and 40 ways to choose the singleton. This produces 7-card hands with 3 pairs.

The other kind of two pairs hand must consist of 5 distinct ranks and
as we saw above, there are 1,277 sets of ranks qualifying for a two
pairs hand. There are
choices for the two ranks
of the pairs and 6 choices for each of the pairs. The remaining cards
of the other 3 ranks may be assigned any of 4 suits, but we must remove
assignments which result in flushes. This results in exactly the
same consideration for the overlap of the suits of the two pairs as
in the final case for flushes above. We then obtain

hands of two pairs of the second type. Adding the two gives 31,433,400 7-card hands with two pairs.

Now we count the number of hands with a pair. Such a hand must have
6 distinct ranks. We saw above there are 1,645 sets of 6 ranks which
preclude straights. There are 6 choices for the rank of the pair and
6 choices for the pair of the given rank. The remaining 5 ranks can
have any of 4 suits assigned to them, but again we must remove those
which produce a flush. We cannot choose all 5 to be in the same suit
for this results in a flush. This can happen in 4 ways. Also, we
cannot choose 4 of them to be in the same suit as the suit of either
of the cards forming the pair. This can happen in
ways. Hence, there are
4^{5}-34 = 990 choices for the remaining 4 cards.
This gives us
hands with a pair.

We could determine the number of high card hands by removing the hands which have already been counted in one of the previous categories. Instead, let us count them independently and see if the numbers sum to 133,784,560 which will serve as a check on our arithmetic.

A high card hand has 7 distinct ranks, but does not include straights.
So we must eliminate sets of ranks which have 5 consecutive ranks.
Above we determined there are 1,499 sets of 7 ranks not containing 5
consecutive ranks, that is, there are no straights. Now the card of
each rank may be assigned any of 4 suits giving
4^{7} = 16,384 assignments
of suits to the ranks. We must eliminate those which resulkt in flushes.
There are 4 ways to assign all 7 cards the same suit. There are 7
choices for 6 cards to get the same suit, 4 choices of the suit to be
assigned to the 6 cards, and 3 choices for the suit of the other card.
This gives
assignments in which 6 cards end up
with the same suit. Finally, there are
choices for
5 cards to get the same suit, 4 choices for that suit, and 3 independent
choices for each of the remaining 2 cards. This gives
assignments producing 5 cards in the same suit. Altogether we
must remove 4 + 84 + 756 = 844 assignments resulting in flushes. Thus,
the number of high card hands is
1,499(16,384 - 844)=23,294,460.

If we sum the preceding numbers, we obtain 133,784,560 and we can be confident the numbers are correct.

Here is a table summarizing the number of 7-card poker hands. The probability is the probability of having the hand dealt to you when dealt 7 cards.

hand | number | Probability |

straight flush | 41,584 | .00031 |

4-of-a-kind | 224,848 | .0017 |

full house | 3,473,184 | .026 |

flush | 4,047,644 | .030 |

straight | 6,180,020 | .046 |

3-of-a-kind | 6,461,620 | .048 |

two pairs | 31,433,400 | .235 |

pair | 58,627,800 | .438 |

high card | 23,294,460 | .174 |

You will observe that you are less likely to be dealt a hand with no pair (or better) than to be dealt a hand with one pair. This has caused some people to query the ranking of these two hands. In fact, if you were ranking 7-card hands based on 7 cards, the order of the last 2 would switch. However, you are basing the ranking on 5 cards so that if you were to rank a high card hand higher than a hand with a single pair, people would choose to ignore the pair in a 7-card hand with a single pair and call it a high card hand. This would have the effect of creating the following distortion. There are 81,922,260 7-card hands in the last two categories containing 5 cards which are high card hands. Of these 81,922,260 hands, 58,627,800 also contain 5-card hands which have a pair. Thus, the latter hands are more special and should be ranked higher (as they indeed are) but would not be under the scheme being discussed in this paragraph.

Home | Publications | Preprints | MITACS | Poker Digest | Graph Theory Workshop | Poker Computations | Feedback

website by the Centre for Systems Science

last updated 18 January 2000