Chapter 3, page 114, Execise 12.

  1. A poker hand is a set of 5 cards randomly chosen from a deck of 52 cards. Find the probability of a
  1. royal flush (ten, jack, queen, king, ace in a single suit).
  2. straight flush (five in a sequence in a single suit, but not a royal flush).
  3. four of a kind (four cards of the same face value).
  4. full house (one pair and one triple, each of the same face value).
  5. flush (five cards in a single suit but not a straight or royal flush).
  6. straight (five cards in a sequence, not all the same suit). (Note that in straights, an ace counts high or low.)

Solutions: (a)

combination <- choose(52,5)
combination
## [1] 2598960
4/combination
## [1] 1.539077e-06
36/combination
## [1] 1.385169e-05
four_of_a_kind<- (choose(13, 1) * choose(48, 1))/choose(52, 5)
four_of_a_kind
## [1] 0.000240096
fullhouse<- (choose(13, 1) * choose(4, 3) * choose(12, 1) * choose(4, 2))/choose(52, 5)
fullhouse
## [1] 0.001440576
flush1_cards <- choose(13, 5) * choose(4, 1)

flush2_cards <- choose(10, 1) * choose(4, 1)

flush_cards <- (flush1_cards - flush2_cards) / choose(52, 5)
flush_cards
## [1] 0.001965402
straight_flush_cards <- (choose(10, 1) * (choose(4, 1)^5)) / choose(52, 5)
straight_flush_cards
## [1] 0.003940038