Andy and Bert have worked out a neat card trick, but they need your help to do it. The puzzle for you is to figure out how the trick works.

The essence of the trick is that you shuffle a normal pack of 52 cards thoroughlyand give 5 cards to Andy. Andy keeps one card, puts the others into a special order and gives them to Bert. Bert looks at the 4 cards and correctly names Andy’s card.

You can assume that the trick involves no deception and no communication to Bert other than the sequence of the 4 cards. Can you figure out how it is done?

Solution over the fold.

Andy does the following steps.

  1. Pick out 2 of the 5 cards that have the same suit (there must be at least 2; if more, choose any 2).
  2. Convert the rank of each card to a numerical value (A=1, J=11, Q=12, K=13), and subtract them.
  3. If the numerical difference is 6 or less, keep the higher card and remember the difference.
  4. Otherwise renumber the lower card value by adding 14. Keep this card and remember the difference (which is now 6 or less).
  5. Put the other card as first in the 4 card sequence.
  6. Label the remaining 3 cards (mentally) as High/Middle/Low based on the numerical value of the card and, for cards of the same rank, the suits Clubs/Diamonds/Hearts/Spades in alphabetical order.
  7. Encode the difference by putting the 3 cards in order using the 6 available patterns eg HML=1,HLM=2,MHL=3,MLH=4,LHM=5,LMH=6.

Bert does the following steps.

  1. The first card in sequence is the card suit.
  2. The 3 remaining cards form a pattern of High/Middle/Low as in Andy’s step 7, giving the numerical difference.
  3. Add this number to the rank value of the first card.
  4. If it exceeds 13, subtract 14. This then is the required card rank.