Two mathematicians perform a trick with a shuffled deck of distinct cards. One mathematician asks a member of the audience to select five cards at random from the deck while the other mathematician is blindfolded. The audience member hands the five cards to the first mathematician who examines the cards, hands one of them back to the audience member, arranges the remaining four cards and places them face down into a neatly stacked pile on a table. The audience member is then allowed to move the pile on the table or change its orientation without disturbing the order of the cards in the pile. The second mathematician now removes his blindfold, examines the four cards on the table and determines the card held by the audience member from these four cards and their order in the pile.

If there were one more distinct card in the deck, the mathematicians cannot perform this trick. How is this trick done?

## Atul S Vasu solved this puzzle:

Let the number of cards be \(n\). The first mathematician is able to send information about a selection of \(5\) cards. There are \(\binom{n}{5}\) ways to select \(5\) cards from a deck of \(n\) cards. The number of possible messages is \(n(n - 1)(n - 2)(n - 3)\). The number of possible messages must be greater than or equal to the number of ways of selecting \(5\) cards from the deck.

\begin{align*} & n(n - 1)(n - 2)(n - 3) \ge \binom{n}{5} \\ & \Leftrightarrow n(n - 1)(n - 2)(n - 3) \ge \frac{n(n - 1)(n - 2)(n - 3)(n - 4)}{5!} \\ & \Leftrightarrow 5! \ge n - 4 \\ & \Leftrightarrow n \le 124 \end{align*}

Number the cards from \(0\) to \(123\). Let us say the first mathematician got the cards \(c_0 \lt c_1 \lt c_2 \lt c_3 \lt c_4\). Pick \(c_i\) to hide such that \(i = \left(\sum_{k=0}^4 c_k\right) \bmod 5\). Let \(s\) be the sum of the numbers of the cards shown. Then \(s + c_i \equiv i \pmod{5}\). This can be rewritten as \(c_i \equiv -s + i \pmod{5}\). There are only 24 possibilities for \(c_i\). It may look like there is \(25\) in the worst case, but it is not. Imagine the remaining cards being renumbered from \(0\) to \(119\). Then \(c_i\) becomes same as \(-s \pmod{5}\). It is a neat trick. These \(24\) possibilities can be represented using a permutation of \(4\) cards.