### Problem 3: Sal the Magician asks you to pick any five cards from a

Problem 3: Sal the Magician asks you to pick any five cards from a standard deck.
You do so, and then show them to Sal’s assistant Pat, who places one of the five cards
back in the deck and then puts the remaining four cards into an arranged pile. Sal is
blindfolded and does not witness any of this. Then Sal takes off the blindfold, takes the
pile of four cards, reads the four cards that Pat has arranged, and is able to find the fifth
card in the deck (even if you shuffle the deck after Pat puts the card in the deck). How
is this trick done? (by Jim Propp)
A standard deck contains 52 cards, 13 denominations (2, 3, 4, . . ., 10, J, Q, K, A) in each
of 4 suits (♦, ♥, ♣, ♠).
Solution: First decide on some order on the deck of cards. One possible way to do
this is to first order the four suits ♣ < ♦ < ♥ < ♠ and then, within each suit, order the
cards as A < 2 < 3 < ... < 10 < J < Q < K. That is, ♣10 < ♦5 < ♠2.
In any hand with five cards, two necessarily have the same suit. Pat puts away one of
the cards within the repeated suit and places one remaining card of the repeated suit first
in the arrangement. When the magician sees that a ♦ card is the first in the arrangement
he knows that he should look for a ♦.
But how to arrange the remaining three cards to indicate the numerical value on card?
With three remaining cards (S=small, M=medium, L=large, ordered by initial ordering),
there are six possible arrangements, and each arrangement can indicate one number: SML
(1), SLM (2), MSL (3), MLS (4), LSM (5), LMS (6). Both Pat and the magician know
this convention. Now, imagine the 13 cards of same suit as points uniformly distributed
on a circle (counterclockwise: A, 2, ..., Q, K, A ). For any pair of cards, one of the cards,
call it C, will be at most six cards away from the other card, C0 , in the counterclockwise
direction. The assistant chooses to put back in the deck the card C, he indicates the suit
by placing C0 first in the arrangement of four cards and he indicates how many cards
away from C0 is the card C by ordering the remaining three cards accordingly (SML = 1
card away, SLM = 2 cards away, and so on.)