## Guessing the Suit

I recently published my new favorite math problem:

A deck of 36 playing cards (four suits of nine cards each) lies in front of a psychic with their faces down. The psychic names the suit of the upper card; after that the card is turned over and shown to him. Then the psychic names the suit of the next card, and so on. The psychic’s goal is to guess the suit correctly as many times as possible.
The backs of the cards are asymmetric, so each card can be placed in the deck in two ways, and the psychic can see which way the top card is oriented. The psychic’s assistant knows the order of the cards in the deck; he is not allowed to change the order, but he may orient any card in either of the two ways.
Is it possible for the psychic to make arrangements with his assistant in advance, before the latter learns the order of the cards, so as to ensure that the suits of at least (a) 19 cards, (b) 23 cards will be guessed correctly?
If you devise a guessing strategy for another number of cards greater than 19, explain that too.

If the psychic is only allowed to look at the backs of the cards, then the amount of transmitted information is 236, which is the same amount of information as suits for 18 cards. This number of guesses is achievable: the backs of every two cards can clue in the suit of the second card in the pair. This way the psychic can guess the suits of all even-numbered cards in the deck. So the problem is to improve on that. Using the info from the cards that the psychic is permitted to turn over can help too.

The problem is from the book Moscow Mathematical Olympiads, 2000-2005. The book and Russian blog discussions provide many different ideas on how to guess more than half of the deck.

Here is the list of ideas.

Idea 1. Counting cards. If you count cards you will know the suits of the last cards.

Idea 2. Trading. As we discussed before, the psychic can correctly guess the suits of even-numbered cards. By randomly guessing the odd-numbered cards she can correctly guess on average the suits of 4.5 additional cards. Unfortunately, this is not guaranteed. But wait. What if we trade the knowledge of the second card’s suit for the majority suit among odd-numbered cards?

Idea 3. Three cards. Suppose we have three cards. Three bits can provide the following knowledge: the majority color, plus the suit of the first and of the second cards in the majority color. Thus, three bits of information will allow the psychic to guess the suits of two cards out of three.

Idea 4. Which card. Suppose the assistant signals the suits of even-numbered cards. With no loss, the psychic can guess the even-numbered card and repeat the same suit for the next card. If this is the plan, the assistant can choose which of the two cards to describe. Which card of the two matches the psychic’s guess provides an additional bit of information.

Idea 5. Surprise. Suppose we have a strategy to inform the psychic about some cards. Suppose the assistant deliberately fails on one of the cards. Then the index of this card provides info to the psychic.

I leave it to my readers to use these ideas to find the solution for 19, 23, 24 and maybe even for 26 cards.

1. #### Code:

I’m a new reader to your blog. Do you want us to share strategies in the comments if we come up with them?

2. #### Tanya Khovanova:

Code,

Yes, please, share the strategies.

3. #### Code:

Alright, I have several for 24. I haven’t quite been able to get up to 26, but I’m still thinking about it. Here’s a (24):

3-bits is sufficient to guess 2 out of 3 cards. but you need 1 of those bits before you start the three cards or else you run into problems, so your first card is guessed at random, and that first bit gives the majority color of the next three. Out of the next three, the first bit gives the suit of the first majority color and the second bit gives the suit of the second card in the majority color. The third bit feeds into the next group of three, telling the majority color. I do 7 groups of three, so including the first card, that’s 1+3*7 = 22 cards so far. Out of the 21 cards in threes, you will get 14 normally, but here is where I use a surprise. On one of the seven (or potentially not at all, representing 000), I screw up the second suit for the majority color. This gives three extra bits at a lose of 1 card, so out of the first 22, I only get 13 correct, but I get 3 surprise bits and 1 bit coming from the last card in the last 3 card set, so 4 extra bits.

For the next four cards, each card provides 1 bit of it’s own, and I use up the 4 bits (1 on each card) to guess each of them correctly. Thus we guess the next 4 out of 4, bringing us up to 17 out of 26. For the next eight cards, I randomly guess the first card, but use its bit to start another chain of 3 cards, this time only 2 in a row. I use the extra bit from the three chain to guess the remaining card of the eight with its own bit, too. Thus, I don’t get the first 1, get 4 out of the next 6, then get the last one correct. That brings us up to 22 out of 34.

Now for the last two, if we’ve been counting cards, then we know there are two suits left. If they are the same, we guess both on the spot and get both right. If they are different, then one of them must be first, so for each of the 6 different situations with two suits, we decide on a bit meaning which one comes first out of the two suits. Thus, we can use our 35th card’s bit to guess what it is, then we know what the last suit is for the 36th card, bringing us up to 24 out of 36.

Is there already a notation for referring to these strategies? My description of where I’m using what technique and where I’m getting bits from can get a *bit* unwieldy.

4. #### Fifteenth Linkfest:

[…] Guessing the Suit (beneath the fluff, there are very interesting questions about information coding here) […]

5. #### David Reynolds:

Finally, I came up with a solution for 25 cards. It is a valid solution as it meets all of the constraints of the problem, but it is not a very good solution as I don’t believe any two humans could actually pull it off due to the complexity. There would be an enormous amount of memorization required. Here’s a clue to my technique. Others have pointed out that the psychic can remember the cards that he has seen and by elimination know the last two cards. The assistant can give a clue so he then knows the order of the last two. Think of this as the assistant letting him know which permutation of the remaining cards is the correct order. Now extend that beyond two cards. Careful to keep in mind what the psychic knows and when he knows it. I had to write a computer program to validate the permutation mappings that I used.

My question is, is there a 26 card solution? You don’t have to reveal it, just let us know if it exists, please.

6. #### Tanya Khovanova:

David, there is a 26 cards solution.

7. #### anonimnystefy:

How can the assistant signal the suits?