Note: I found this puzzle on quora. I don't have a solution for it. I couldn't find it referenced using google search.

This time the jailor gives two of his favourite prisoners a chance to escape.

He tells them that, on the following day he would take one of the prisoners to a closed cell which has only a small opening in a wall, large enough for a hand to fit in. The second prisoner would be standing on the other side of the opening outside the cell. He would then give, 5 cards randomly (from a deck of 52 cards) to the prisoner in the cell and then, the prisoner after having a look at all the 5 cards, should return one card back to the jailor and pass on the remaining 4 cards one by one to the second prisoner outside through the hole.

The jailor then comes out to the second prisoner and asks him to name the card which has been returned by the first prisoner. If he names it right, both go scot free!

Note: The prisoner can take some time before passing the cards, but once he starts he has to pass them quickly in succession. Also, all cards should be passed face-up only!

Now both the prisonsers who share the same cell have one full day to devise a strategy so that no matter who is picked up by the jailor and whichever 5 cards he chooses to give to that prisoner, the second prisoner should name the 5th card correctly after looking at the 4 cards passed on to him. How do they do it?

  • $\begingroup$ ok, a different search query got me the answer. :) $\endgroup$
    – rents
    May 25, 2015 at 9:17
  • $\begingroup$ Welcome to Puzzling SE, and nice first question! $\endgroup$ May 25, 2015 at 9:29

1 Answer 1


(This is actually a puzzle I was planning to post here quite soon...)

Let $C_1,C_2,C_3,C_4,C_5$ be the five cards. By the pigeonhole principle, two of these must have the same suit, say $C_1$ and $C_2$. (If more than two pairs match in suit, just pick any matching pair.) Consider the value of the cards mod 13 (so that the ace is worth one more than the king but also one less than the 2); then one of these two, say $C_2$, must be worth at most six more than the other.

The first prisoner then chooses $C_1$ and passes the other four cards out to the second prisoner with $C_2$ on top. The difference between the values of $C_1$ and $C_2$, a number between 1 and 6, can be signalled by the order of the bottom three cards, since there are $3!=6$ permutations. Different permutations can be coded by where the least valuable and most valuable of the cards are. Note that the prisoners have to agree beforehand on an order for the suits, so that all 52 cards can be placed in order of value.


Not the answer you're looking for? Browse other questions tagged or ask your own question.