# How many Questions will you need to Guess the Card?

Suppose your friend grabs a random card from a deck. Now you can ask questions about that card. You can only ask yes/no and greater/less than questions. How many questions do you need to determine the card?

## Questions like these are not allowed:

• Is its value between 1 and 6?

## These are:

• Is its suit clubs?
• Is it a face card?
• Is its value greater than, less than, or equal to six?
• Why is "is its value between 1 and 6" not allowed? – user20 Nov 13 '14 at 23:02
• @Emrakul it asks if it's in between a range. This can change the answer significantly. You should only be able to ask yes/no questions for suit, and if it's a face card. For value it has to be a greater/less than/equal to question. – warspyking Nov 13 '14 at 23:04
• The range questions don't help you, do they? Once you've determined the suit, you have 13 cards left. You need at least four binary questions to separate these, and the higher/lower ones let you do it in four. – Peter Nov 13 '14 at 23:25
• Yeah, so 6 total after one question to determine the color of the suit and a second question to determine what the suit actually is. – pacoverflow Nov 13 '14 at 23:32
• What exactly is allowed for the questions? Is it any question that is binary, excluding ranges? "Is it's [sic] value between 1-6" is yes and no, so disallowing it doesn't follow your original rules. If this was more specific it would help. – mdc32 Nov 14 '14 at 0:19

I think it can be done in

six questions in the worst case

First, we determine the color, and then the suit in two questions. Then, numbering the cards 1 through 13, we ask is it higher, lower, or equal to 7 (three questions). Worst case, it's not seven and we have six cards left. If its the lower six, we ask if it's higher than 3 (four questions). We now have three consecutive values left. We use our fifth question to ask if it's higher equal to or lower than the middle one, this gives us the answer which we reveal in the final question.

We could also use a question with three answers for the fourth, but this is easier to explain.

• You'd need a 7th answer to guess it though. – warspyking Nov 13 '14 at 23:37
• Does that count as a question? I'm just giving the answer. – Peter Nov 13 '14 at 23:42
• You need to guess it. Yes it's a question. – warspyking Nov 14 '14 at 0:01
• I've changed the answer, also to include the color question. – Peter Nov 14 '14 at 0:05
• Why should the last one be a question? It's not a guess by any means - it's completely accurate. It's also not even a question, just simply "The card is the 3 of diamonds" or whatever card it is. – mdc32 Nov 14 '14 at 0:17

The optimal number of questions that could be achieved is 5 questions. I will demonstrate with only 6 questions (improving from 7 as stated on other answers).

As others have, determine suit in two questions:

2. Is your suit xxxx (per above) If yes, you know the suit from the question. If no, you know the suit from the only other suit with that color.

Thinking of the type of card as Ace, Two, Three, ..., ..., Queen, King:

1. Are the number of letters in the type of card is less than, greater than or equal to 4? If less than 4 letters, your card is an Ace, Two, Six, or Ten. If more than 4 letters, your card is a Three, Seven, Eight or Queen. If equal to 4 letters, your card is a Four, Five, Nine, Jack or King. I'll take each of these separately.
2. Case less than 4 letters: Is your card value less than, greater than or equal to six? If equal or more, you know the card value, so proceed to ask for the card. If less, you have a 5th question for whether ace or two.

Now for the next case:

1. Case more than 4 letters: Is your card value less than, greater than or equal to Eight? If equal or more, you know the card value, so proceed to ask for the card. If less, you have a 5th question for whether three or seven.

And the last case.

1. Case equal to 4 letters: Is your card value less than, greater than or equal to Nine? If equal, you know the card value, so proceed to ask for the card. If less, you have a 5th question for whether four or five. If more, you have a 5th question for whether jack or king.

And finally the question for their card:

1. (or this could be the 5th question): Combine the suit found above with the value determined to ask the exact card value.

Mathematically, the maximum values you can determine with a two value question (yes/no) is n=2^(q-1) where n is the number of items you are asking against and q is the number of questions asked. If the scenario was "how many questions until you know the answer, the formula would be n=2^q but the OP stated the last question had to be asking the value, so this takes one more question. In our case 1 question will be required if there is only one item queried against. 2 questions required for 2 items, 3 questions for up to 4 items, 4 questions for up to 8 items, (etc.).

However, that is not the case in our example. Since the OP allows for a 3 value answer (less than, equal or greater), the optimal equation is 3^(q-1). This means with optimal questions, you can split the number of possibilities by 1/3 for each question. 1q= 1 item, 2q= 3 items, 3q= 9 items, 4q = 27 items, 5q = 81 items. With optimal questions, 52 cards should be able to be found with just 5 questions. In this case I have demonstrated using 6 questions.

is it's suit club or spade? if answear is no: is it's a diamond? if answear is yes: is it's a spade? Then you know the right suit. Since "interval" isn't allowed then I assume you can ask if it's a black card?

Is it's value >7? Is the cards value even? This leaves you with four possible cards left in the worst case. ie. A,3,5,7: Is the card >3?, Then you pick a card from either side of the interval depending on the answear.

I needed 6 questions for that.

The following answer makes the assumption that counterfactual conditionals are acceptable and the answerer may NOT have an answer (be it yes or no).

Optimally, with this approach, we can achieve the result in 4 questions (not including the last question regarding the identity of the final card).

Here is an example:

If the card doesn't have a face, is it black?
If your card is divisible by 2, is it a heart?
If your card is greater than 5, is it a heart?
If your card is equal to 5, is it a 5 of diamonds?
Is your card the 3 of diamonds?


By asking if-clause questions which are contrary to the fact, we are reducing the pool of possibilities by getting either 1 or 2 questions answered simultaneously. If silence is not a possible response, then this approach obviously fails.

5 questions:

First question would be "With suit value as 0 for club, 1 for diamond, 2 for hearts, and 3 for spades calculate the total value of the card as 13 times the suit value plus the card value, except all diamonds above 5 of diamonds have total value 30 as does all hearts less than 10 of hearts; is the total value equal to, greater than or less than 30"? This reduces the set of possible cards to a set with at most 18 cards. Proceed with similar questions to reduce the potential cards by one third in each question.