Source

I got this problem from Rustan Leino, who learned about it from Lyle Ramshaw. See also puzzles 19 and 20 on the following large collection of mathematical puzzles. A more challenging generalization of this problem is at the following link.

I solved it and wrote up my solution.

Problem

In this problem, you and a partner are to come up with a scheme for communicating the value of a hidden card in a normal 52-card deck. The game is played as follows:

- Once you and your partner have finished strategizing, your partner is sent out of the room.
- The dealer hands you five cards from the deck.
- You look at the cards and hand them back to the dealer, one by one, in whatever order you choose.
- The dealer lays them in a row in the order you gave them to her. She puts the first card face-down and the rest face-up. Thus, while you control the order of the cards, you have no control over their orientations. So, you can't use orientation to transmit information to your partner.
- You leave the room and your partner enters the room.
- Your partner looks at the cards and the order in which they lie and, from that information (and your previously-agreed-upon game plan), guesses the face-down card. If the guess is correct, you win.

What scheme can you and your partner use to always win?

Solution
Reveal

First, choose a pair of cards of the same suit. This must be possible since you're handed more cards than there are suits. Next, pick the card in that pair that's 1–6 ranks higher than the other, if one considers ranks to wrap around, and let $n$ be the number of ranks that card is higher than the other card. This must be possible since there are only 13 cards in each suit. For instance, if the two cards are the 3 and Q of hearts, then you choose the 3 and let $n = 4$ since the 3 is four ranks higher than the Q, counting Q-K-A-2-3.

Next, hand the dealer the chosen card, followed by the other card in the pair.

Finally, compute the $n$th lowest permutation of your remaining three cards, using whatever sort order you agree on with your partner. This must be possible since there are six possible permutations and $1 \leq n \leq 6.$ Hand the dealer those three cards in the order given by that permutation.

When your partner comes in the room, she can compute $n$ based on the permutation she sees of the last three cards. She can determine the suit of the hidden card from the suit of the first face-up card. Finally, she can add $n$ to the first face-up card's rank to determine the rank of the hidden card.