# Calculating combinations of three of a kind in Texas Hold 'Em

The question sounds quite simple - in a game of Texas Hold'Em (or simply out of $${52 \choose 7}$$), how many combinations of cards are there, that would result in three of a kind being the highest hand?

The Wikipedia article about poker probabilities says, that the frequency of three of a kind in a 7-card poker game is 6,461,620.

I have tried to arrive at that solution by first calculating all possible three card combinations: $${4 \choose 3} 13 = 52$$, and then multiplying that number by the amount of possible combinations of the other 4 cards, however quickly realised that 6,461,620 isn't divisible by 52 which throws my plan out of the window.

How do I arrive at the correct amount of possible combinations?

First we count the number of hands with three of a kind, no four of a kind, and no other pair. There are $$13$$ ways to pick the three of a kind, $$4$$ ways to pick the three cards of that kind, $$48$$ acceptable cards for the first odd card, then $$44,40,36$$ for the following ones, but we have to divide by $$4!=24$$ for the orders of picking the four odd cards. That gives $$13\cdot 4 \cdot 48 \cdot 44 \cdot 40 \cdot 36/24=6,589,440$$ hands with three of a kind and no full house or four of a kind. Note this is not many more than the Wikipedia result. We now need to deduct the number of hands that have a straight or flush.
The flushes are reasonably easy. Again there are $$13\cdot 4$$ ways to get the three of a kind. Then there are $$3$$ ways to choose the suit of the flush and $${12 \choose 4}=495$$ ways to select the other cards for a total of $$77,220$$ hands with three of a kind and a flush (which includes the straight flushes).
For straights we will start with the straight. The Wikipedia page shows (assuming that ace low straights count) there are $$10,240$$ ways to choose the five cards of a straight including straight flushes. Then there are $$5$$ ways to pick which card will have the three of a kind and $$3$$ ways to pick the two other cards, but we have to divide by $$3$$ for which of the three of a kind was part of the original straight so $$10,240\cdot 5 \cdot 3/3=51,200$$ hands to deduct.
We have deducted the straight flush hands twice, once for the straight and once for the flush. We need to add them in once. There are $$40$$ straight flushes, $$5$$ ways to pick the rank that has three of a kind, and $$3$$ ways to pick the missing suit for $$600$$
This winds up with $$6,589,440-77,220-51,200+600=6,461,620$$ hands with three of a kind and nothing higher, in agreement with the Wikipedia page.