# Explanation of the solution to Fitch Cheney's $124$-card trick

In Peter Winkler's Mathematical Puzzles A Connoisseur's Collection, he posed Fitch Cheney's card trick problem as follows. His solution for the last question concerning the $$124$$-card, rather than the original $$52$$-card version is as follows. However, I find myself puzzled by the solution. What is $$k$$? Is this a typo which is supposed to be $$j$$ and presumably $$x=c_j$$ the card Dorothy pulls out? We know neither $$j$$ or $$k$$ nor $$c_k$$ or $$c_j$$ or $$x$$. We need that to position $$x$$ in one of the modulo of $$5$$ before we can pick the exact position from amongst the $$4!$$ possibilities within each modulo class. Can someone explicate the solution?

Note: I understand the original $$52$$ card solution. Please do not explain that basic version.

Epilogue: I found Michael Kleber's The Best Card Trick. It gives a clear presentation. However, the new numbering system modulo 5 is best explained by the answer of @LonzaLeggiera below. This answer also has some good references on this problem.

• Ah! I had seen this in a book of puzzles for the $52$ case in school. $+1$ for the question, and let me tell you I used to be David in school for this one! The kids loved it. Aug 16, 2019 at 3:38
• Note the "closing the gap" part... that clear things up for me. Aug 16, 2019 at 4:22
• That sentence can be written as "find a number $x$ such that there exists a $k$ such that $x$ is $c_k$ and $x \equiv -s+k \pmod 5$". Aug 16, 2019 at 4:26
• @user202729: That is clearer. But why does such $k\neq j$ exist and is unique?
– Hans
Aug 16, 2019 at 5:11
• I've heard this trick referred to as "communicating the card". Aug 16, 2019 at 19:30

Apart from the confusing description of what it is that "David needs to find", the trick won't work as described because of an error in the way Winkler indexes the cards chosen by the stranger. If you're going to use a sum mod $$5$$ as an index, then you need to index the cards as $$\ c_0, c_1, \dots, c_4\$$ rather than $$\ c_1, c_2, \dots, c_5\$$. If you use the latter indexing, which is what Winkler seems to assume later on in his explanation, then Dorothy has to choose the card $$\ c_{j+1}\$$ rather than $$\ c_j\$$, and David has to obtain a number $$\ x\$$ such that $$\ x\equiv -s + k \hspace{-0.3em}\mod 5\$$ and $$\ x = c_{k+1}\$$, which is what I'll assume in the rest of this answer.

If $$\ b_0 are the cards remaining in the deck after the four which Dorothy hands to David have been removed from it, and $$\ x= c_i\ (i=j+1)\$$ is the face value of the card Dorothy removes from the five chosen by the stranger before handing the remaining four to david, then $$\ x=b_{x-i+1}=b_{x-j}$$. Then if $$\ s\$$ is the mod $$5$$ sum of the face values of the four cards Dorothy hands to David, $$\ \sigma\equiv -s\equiv x-j\hspace{-0.3em}\mod 5\$$, and $$\ d\$$ the unique number in the set $$\ \left\{0,1,\dots,23\right\}\$$ such that $$\ x-j=5d+\sigma\$$, Dorothy rearranges the cards in the order that she has prearranged with David to represent the number $$\ d\$$. David can recover $$\ d\$$ by inspecting the arrangement of the cards, and $$\ \sigma\$$ by calculating the mod $$5$$ sum of their face values, so he can calculate the value of $$\ x-j\$$ and $$\ x=b_{x-j}\$$.

So...

(The puzzle omitted to mention that Dorothy is allowed to rearrange the cards. I don't see why this should be assumed if it isn't mentioned. After all it is assumed that David can't see which of the five cards Dorothy removes so that David won't know the value of $$j$$. The puzzle would be very different if David knew what $$j$$ was. And there's no reason, according to what the puzzle has stated, that David can't watch Dorothy put the cards in order and watch her remove precisely the $$j$$th card...)

Let $$j \equiv c_1+c_2+c_3+c_4+c_5 \pmod 5$$ and $$1 \le j\le 5$$. Dorothy removes $$c_j$$.

Let $$s = ( c_1+c_2+c_3+c_4+c_5)- c_j\equiv j-c_j \pmod 5$$. David knows the value of $$s$$.

David has four cards which he will call $$A_1 < A_2 < A_3 < A_4$$

So the way I see David figures:

If the missing card is $$c_k=x$$ where he doesn't know what $$k$$ or what $$x$$, then $$s \equiv k - x\pmod 5$$ or $$x \equiv k-s \pmod 5$$ and $$A_{k-1} < x < A_k$$ (if $$k-1=0$$ of $$k=5$$ just ignore the non-defined $$A_{term}$$). He tries to solve these for $$k = 1,2,3,4,5$$.

Now if we relabel the numbers $$1....124$$ to the numbers $$1..... 120$$ by omitting $$A_1,...,A_4$$ the $$x$$ will get translated to $$x'$$ and $$x'=x$$ if $$x < A_1$$. And $$x'=x-1$$ if $$A_1 < x < A_2$$ and $$x'=x-2$$ if $$A_2< x < A_3$$ and so on.

So $$s \equiv k - x\pmod 5$$ or $$x \equiv k-s \pmod 5$$ and $$A_{k-1} < x < A_k$$ all be become the equation $$s \equiv 1-x'\pmod 5$$. where $$1 \le x' \le 120$$.

There are $$24$$ possible such $$x'$$s. And there are $$24$$ ways to arrange the cards $$A_1,A_2,A_3,A_4$$. Dorothy rearranges the remaining $$4$$ cards to indicate the which of the $$24$$ values $$x'$$ is.

.......

So for example. Let's say the cards are $$21, 27, 86, 110, 114$$.

Then $$21+27+86+110+114 = \equiv 3\pmod 5$$. So Dorothy removes the $$3$$rd card: $$86$$. Dorothy does a subtraction of $$c_j - (j-1)$$, in this case, $$86-(3-1) = 84$$. And Dorothy figures $$s = 21+27+110+114= 272\equiv -3\pmod 5$$ and $$84 \equiv 1-272\equiv 1+3 \equiv 4\pmod 5$$. Furthermore $$84 = 16*5 + 4$$.

So Dorothy rearranges $$2127,110,114$$ into the $$16$$th permuations. The sixteenth permutation is.. lets see... if $$abcd$$ through $$adcb$$ are the first six permutations, then $$cabd$$ through $$cdba$$ are the thirteenth through eighteenth, And $$cabd$$ and $$cadb$$ are the 13th and 14th, $$cbad,cbda$$ are the 15th and 16th. So we want the permutation $$cbda$$.

So Dorothy arranges the cards as $$110,27,114,21$$.

David sees those cards and sees they are arranged in order of $$cbda$$ and figures they are the $$16$$th permutation.

He adds $$s=110,27,114,21= 272$$. $$1-272 \equiv 4\pmod 5$$. And $$16*5 + 4 = 84$$. $$84 \not < 21$$. And $$21 \not < 85 \not < 27$$. But $$27 < 86 < 110$$ so David figures the card is $$86$$.

Deck of 124 blank cards numbered one through 124. Spectator randomly picks any five cards. The magician picks one of those five cards as Target and has spectator put it in their pocket. Then the magician arranges other four cards in a sequence that his assistant can decipher to determine the Target card.

ENCODING (magician) calculation synopsis: mod five on all five cards to determine 1-5 value (if zero make it 5) position of the Target card. Then Target (1 thru 124) value plus constant 5 then minus the 1-5 value then divide by constant 5 (round down) to get the 1-24 value to rearrange the four remaining cards.

DECODING (assistant) calculation synopsis: Mod five on the four cards giving 1-5 value. Look at four cards sequence and determine the 1-24 value then multiply that by constant 5 then add 1 then subtract the 1-5 value. Adjust up by 1 for each of 4 cards passed or hit. This arrives at the Target card number.

Details about the 1-24 number used by both the encoding and decoding calculations: Note that there are 24 combinations that the four cards can be arranged in and if say 16 is the combination number this means to use the 16th combination. Here is how we figure that combination: A. there are four groups of six combinations B. those four groups are 1-6, 7-12, 13-18, 19-24 C. the 16 falls in the 13-18 group which is the third group this means that the first of the four signal cards must be the third highest. Now for the other three cards they use the standard Fitch Cheney signaling sequence of 1-6 using the low medium high technique to pinpoint which one of the six by: LMH=1 LHM=2 MLH=3 MHL=4 HLM=5 HML=6 so in our example 16 is the 4th number within the 13-18 range therefore the remaining three cards must signal the number 4 therefore the 3 numbers must be in medium high, low, order in our example of 16. Note that the 1-24 number is NOT the target number but is used to help calculate the target number.

Note that instead of blank cards numbered one through 124 you could use three regular decks and write in big numbers on their backs: redback cards 1-52 blue Back cards 53-104 green back cards (only 20) 105-124 or instead of carrying a fat deck you could have a random spectator call out five numbers in that range (1-124) and you the magician write those numbers on a large pad (so all can see) and work from there.

Note that mathematicians have referred to or described the 124 trick but in terms that are difficult for non-mathematicians to understand therefore I Larry Finley and brother David Finley have tried to state this in a way that an average magician can understand and do this trick.

I have also written a spreadsheet that can serve as the assistant on a cell phone thereby allowing the magician to do this 124 trick anytime without having a human assistant.

According to my research mathematicians who have written about this 124 version: Elwyn Berlekamp (deseased) Stein Kulseth Gadiel Seroussi Michael Kleber and wife Jessica Polito Bill Cheney Norman Do Ravi Vakil Colm Mulcahy Tsai Simonson Tara Holm Art Benjamin Persi Diaconis Note according to my research Michael and Jessica are the first I can find to actually perform the 124 version before live audiences in 2001-2002.