The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+1 vote
163 views
A poker hand consists of 5 cards. If the cards have distinct consecutive values and are not all of the same suit, we say that the hand is a straight. For instance, a hand consisting of the five of spades, six of spades, seven of spades, eight of spades, and nine of hearts is a straight. How many ways are there to get a "straight"? Assume that there are totally 52 cards.
asked in Theory of Computation by Junior (913 points) | 163 views

2 Answers

+2 votes

Let us assume that (R1,R2,R3,R4,R5) are the consecutive ranks of the cards in the poker hand.

Let us assume (R1,R2,R3,R4,R5) = (A,2,3,4,5)

Now, I will find the number ways we can have the cards having rank A,2,3,4 and 5 in our poker hand.

Here card of rank A has 4 options it can come from any of the 4 suits

Same goes for the cards of rank 2,3,4 and 5

Thus the number of ways we can have the ranks (A,2,3,4,5) in our poker hand is 45.  

Now, a restriction given in the question is that our poker hand should be straight that is the five cards in our hands will not be of same suit.

So, we have to substract those cards which will form a straight flush that is the five cards in our hands are of same suit.

The number of ways to form a straight flush with the ranks (A,2,3,4,5) is 4

Hence the number of ways we can have the ranks (A,2,3,4,5) such that it forms a straight is 45 - 4.

Now, note that we can have $13$ five tuples of the form (R1,R2,R3,R4,R5) which are given below 

{ (A,2,3,4,5) , (2,3,4,5,6), (3,4,5,6,7), ........, (J,Q,K,A,2), (Q,K,A,2,3),(K,A,2,3,4) }

So, for each of the above 5 tuples we can have 45 - 4 straight hands.

Hence our required answer is 13 * (45 - 4) straight hands possible in a poker game.

answered by Loyal (5.7k points)
+1 vote

Let us say we want 5 consecutive cards: {x, x+1,...,x+4}. First let us count how many ways are there for a fixed x (card number is fixed not the suite), without any restriction. This is equal to 4^5 (4 suites of 5 cards). We will now subtract the case when the suite of all cards is same, this is just 4. So for a fixed x, ans = 4^5-4. But these 5 cards can come in any order, so we have to multiply a 5! to adjust that.

If we assume that the A<2<3<4<5<6<7<8<9<10<J<Q<K, i.e. x (the lowest card can be from A to 9) (or 9 different starting values) 
Ans = 9*5!*(4^5-4)

(Note: A straight in poker also allows {10,J,Q,K,A} under some rules, https://en.wikipedia.org/wiki/List_of_poker_hands#Straight; I have not considered this in my answer)

answered by (251 points)


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

35,518 questions
42,792 answers
121,605 comments
42,162 users