0
$\begingroup$

I'm currently in the process of writing an application related to poker, and I've been struggling to determine the full formula for a piece of this. I need to determine the number of ways to combine x cards (ignoring suit) where the best 5 card hand made from that combination is not a straight or high card hand. First piece. f(x, y) is r-com with repetition of x possible values for y cards, g(x, y) is r-com without repetition, i is the number of cards in a hand. Here's where I'm at so far:

f(13, i) - g(13, i) - f(13, i-5)

So that's all combinations of cards where at least one card is repeated at least once, but no card is repeated at least more than 4 times. However, I forgot to account for the fact that at 6 cards or more, it's possible to have both a straight and a pair. So I need to subtract those. Here's what I've got so far for that:

9*(f(12, i-5) - g(7, i-5))
+
(f(13, i-5) - g(8, i-5))

However, this number also doesn't work for 8 or more cards, as the second part of the formula includes cases where you have both a straight and a full house, four of a kind, or an illegal hand (5 or more of a card). And that's where I'm stuck. Any help would be very much appreciated!

  • 0
    Are you looking for the number of hands that have at least one pair? You don't say whether you count hands with a flush (five of a suit). Alternately, if there is a straight, does there have to be a higher hand, such as a flush, full house, or four of a kind?2012-05-08
  • 0
    Flushes are irrelevant as I'm working in a way that ignores suit. And yes, that is what I'm trying to exclude from the second formula are hands where there is a straight and a higher hand (full house, four of a kind, and illegal hands which it also includes right now)2012-05-09

1 Answers 1

1

It sounds like you want the number of hands that have no pairs as all full houses, four of a kinds, etc. have one. The number of $n$ card hands that have no pair is $52 \cdot 48 \cdot 44 \ldots (56-4n)$ as each card you draw prevents three more from being added.

  • 0
    I'm looking for hands specifically with straights and pairs, but no full houses or four of a kinds. I also don't want suit being a part of this equation, as my program doesn't care if the pair is hearts and clubs or spades and diamonds.2012-05-09
  • 0
    @sgrif: You said not straights or high card hands, which to me sounded like yes to any pair. What about three of a kind or multiple pairs? Are they OK?2012-05-09
  • 0
    Yes. I've already gotten the formula for any pair. The issue is at 6 or more cards it's possible to have a straight and a pair, which I need to exclude. However, at 8 or more cards it's possible to have a straight and full house or straight and four of a kind which I do want included.2012-05-10
  • 0
    @sgrif: you need to clearly state what combinations are allowed and what are not. It sounds like you are excluding straights, straight+one pair, no straight or pair. What about straight+two pair, straight+three of a kind, straight+three pair, etc.?2012-05-10
  • 0
    Here's the simplest way to put it. The final result I need the number of combinations of cards where the best 5 card combination is not a straight, flush, or high card hand (ignoring suit). The formula I've got gives me all hands with any sort of pair, I need to remove from that number any hands that would have any sort of paired card, but the best 5 cards is a straight.2012-05-11