% !TEX TS-program = xelatex
\documentclass{../leelavati}

\usepackage{qrcode}

% -------------------------------------------------------------------
% Playing-card drawing helpers (TikZ)
% -------------------------------------------------------------------
\definecolor{cardred}{HTML}{C0392B}
\definecolor{cardblack}{HTML}{1A1A1A}

% Map a suit letter S/H/C/D to a symbol (\cursym) and a colour (\curcol)
\newcommand{\cursym}{}
\newcommand{\curcol}{cardblack}
\newcommand{\setsuit}[1]{%
  \ifstrequal{#1}{S}{\def\cursym{\spadesuit}\def\curcol{cardblack}}{}%
  \ifstrequal{#1}{H}{\def\cursym{\heartsuit}\def\curcol{cardred}}{}%
  \ifstrequal{#1}{C}{\def\cursym{\clubsuit}\def\curcol{cardblack}}{}%
  \ifstrequal{#1}{D}{\def\cursym{\diamondsuit}\def\curcol{cardred}}{}%
}

% Inline coloured card token, e.g. \cc{4}{S} -> 4 of spades
\newcommand{\cc}[2]{\setsuit{#2}\textcolor{\curcol}{\textsf{\textbf{#1}}\,\ensuremath{\cursym}}}

\tikzset{cardframe/.style={draw=black!55, line width=0.4pt, rounded corners=1pt, fill=white}}

% Face-up card centred at (#1,#2) with rank #3 and suit letter #4
\newcommand{\drawcard}[4]{%
  \setsuit{#4}%
  \draw[cardframe] (#1,#2) +(-0.375,-0.55) rectangle +(0.375,0.55);
  \node[anchor=north west, font=\sffamily\bfseries\footnotesize, text=\curcol]
        at (#1-0.32,#2+0.5) {#3};
  \node[font=\Large, text=\curcol] at (#1,#2-0.04) {$\cursym$};
}

% Face-down card centred at (#1,#2)
\newcommand{\drawback}[2]{%
  \draw[cardframe, fill=magHighlight!80, draw=magHighlight!55] (#1,#2) +(-0.375,-0.55) rectangle +(0.375,0.55);
  \draw[white, line width=0.5pt] (#1,#2) +(-0.26,-0.42) rectangle +(0.26,0.42);
}

% Numeric card (for the 124-card deck), centred at (#1,#2) showing number #3
\newcommand{\drawnum}[3]{%
  \draw[cardframe, fill=magHighlight!12] (#1,#2) +(-0.42,-0.52) rectangle +(0.42,0.52);
  \node[font=\sffamily\bfseries\small] at (#1,#2) {#3};
}

% Small face-up / face-down tiles for the "Ups and Downs" figure
\newcommand{\udU}[2]{%
  \draw[cardframe, fill=white] (#1,#2) +(-0.12,-0.2) rectangle +(0.12,0.2);
  \node[font=\tiny, text=cardblack] at (#1,#2) {$\spadesuit$};}
\newcommand{\udD}[2]{%
  \draw[cardframe, fill=magHighlight!75, draw=magHighlight!55] (#1,#2) +(-0.12,-0.2) rectangle +(0.12,0.2);}

\begin{document}

\selectlanguage{english}
\setstretch{1.1}

\title{\LARGE The Fitch Trick: Solutions \& Variations \\
\large ଫିଚ୍‌ଙ୍କ ତାସ ଖେଳ ଏବଂ ଏହାର ରହସ୍ୟ}
\author{\AuthorDual{ନୀଲ୍‌ଧାରା ମିଶ୍ର}{Neeldhara Misra}}
\date{}
\maketitle

\setstretch{1.2}

\begin{abstract}
TBD.
\vspace{14em}
\end{abstract}
\setstretch{1.05}

In the trick we presented in the last issue, Badarika the assistant studied
five cards an audience handed her, slipped one away, and laid the other four
face-up in a row. The magician Aalaya—who had been out of the room
throughout—walked in, glanced at the four cards, and named the fifth. 

These five cards could be cards from a standard deck of 52 cards, or cards from a deck of 124 cards. Last time, we saw how to work with 124 cards if we were allowed a physical gimmick. This time we'll see how to pull off the trick fair and square: so it's doable even over a phone call, where the assistant has to rely purely on card order and no extra signals. 

\section*{A Recipe for 124 Cards}

So here is our upgrade to the pro version of this trick. Let's discuss the encoding first. When Badarika receives five cards, she sorts them mentally into increasing order
and assigns them positions $0,1,2,3,4$ from smallest to largest. She adds all
five card-numbers together, divides by $5$, and notes the remainder; call it
$i$. \emph{She hides the card in position $i$} and lays the other four face-up
in a carefully chosen order. That is the complete hiding rule.

The reason this choice is clever comes down to a small bookkeeping trick. Write
the sorted hand as
\[
c_0<c_1<c_2<c_3<c_4,
\]
and suppose Badarika hides $c_i$. Aalaya sees the other four cards and calls
their sum $s$. Now imagine setting those four visible cards aside and
renumbering the remaining $120$ cards in increasing order, from $0$ up to
$119$.

What is the new number of the hidden card? Deleting cards only affects a card's
label by removing the deleted cards below it. Since $c_i$ was the $i$-th
smallest card in the original five-card hand, exactly $i$ of the visible cards
lie below it. So, in the renumbered deck, the hidden card has new label
\[
c_i-i.
\]
But $i$ was chosen to be the total hand-sum modulo $5$. Since that total is
$s+c_i$, we have $i \equiv s+c_i \pmod 5$, and therefore
\[
c_i-i \equiv c_i-(s+c_i) \equiv -s \pmod 5.
\]
This is the key fact. The choice of which position to hide exactly compensates
for the leftward shift caused by deleting the visible cards.

{\color{red}Potential to add a problem here.}

Among $120$ candidates, exactly $120/5 = 24$ share any given remainder, so the
forced remainder cuts Aalaya's search to $24$ cards
(Figure~\ref{fig:residue}). The arrangement of the four revealed cards then says
\emph{which} of those $24$ it is—and since four distinct cards admit exactly
$24$ orderings, the match is exact. Reading the arrangement as a number $p$ from
$0$ to $23$, Aalaya computes the hidden card's new number as
$5p + ((-s)\bmod 5)$. Then she converts that new number to an actual card number
by a simple counting-over step: she runs through the revealed cards in order,
and each time a revealed card sits at or below her running answer, she bumps the
answer up by one.

\begin{figure}[H]
\centering
\begin{tikzpicture}[x=1cm,y=1cm,
  shown/.style={draw=black!35, fill=black!5, rounded corners=1pt, inner sep=2.5pt, font=\scriptsize},
  hidden/.style={draw=magHighlight, fill=magHighlight!18, rounded corners=1pt, inner sep=2.5pt, font=\scriptsize\bfseries},
  cand/.style={draw=black!25, fill=white, rounded corners=1pt, inner sep=2pt, font=\scriptsize},
  hit/.style={draw=magHighlight, fill=magHighlight!18, rounded corners=1pt, inner sep=2pt, font=\scriptsize\bfseries}, scale=1.2
]
  \node[font=\scriptsize\bfseries, text=black!70] at (1.25,0.45) {old labels};
  \node[font=\scriptsize\bfseries, text=black!70] at (4.95,0.45) {new labels $\equiv 1$};

  % Old labels from the worked example.
  \draw[black!35, line width=0.6pt, -{Stealth[length=3.5pt]}] (1.25,0.15) -- (1.25,-3.75);
  \foreach \y/\num/\sty in {0/7/shown,-0.95/37/shown,-1.45/38/hidden,-2.45/61/shown,-3.35/94/shown}{
    \draw[black!35] (1.14,\y) -- (1.36,\y);
    \node[\sty] at (1.25,\y) {\num};
  }
  \node[font=\scriptsize, text=black!60] at (1.25,-0.48) {$\vdots$};
  \node[font=\scriptsize, text=black!60] at (1.25,-1.95) {$\vdots$};
  \node[font=\scriptsize, text=black!60] at (1.25,-2.90) {$\vdots$};

  % Candidate new labels with the forced residue.
  \draw[black!35, line width=0.6pt, -{Stealth[length=3.5pt]}] (4.95,0.15) -- (4.95,-3.75);
  \foreach \y/\num/\sty in {0/1/cand,-0.45/6/cand,-0.90/11/cand,-1.35/31/cand,-1.80/36/hit,-2.25/41/cand,-3.35/116/cand}{
    \draw[black!35] (4.84,\y) -- (5.06,\y);
    \node[\sty] at (4.95,\y) {\num};
  }
  \node[font=\scriptsize, text=black!60] at (4.95,-1.15) {$\vdots$};
  \node[font=\scriptsize, text=black!60] at (4.95,-2.80) {$\vdots$};

  \draw[magHighlight, line width=0.9pt, -{Stealth[length=3.8pt]}]
    (1.70,-1.45) -- (4.48,-1.80);
  \node[font=\scriptsize, text=magHighlight, align=center] at (3.05,-1.18)
    {$38-2=36$\\[-1pt]{\tiny delete $7$ and $37$ below}};
  \node[font=\scriptsize, text=magHighlight] at (5.75,-1.80) {$p=7$};
\end{tikzpicture}
\caption{A concrete picture of the renumbering in the worked example. The
shown cards below $38$ are $7$ and $37$, so deleting the shown cards changes
the hidden card's label from $38$ to $38-2=36$. Since $36\equiv 1 \pmod 5$, it
appears as the $p=7$ entry among the $24$ possible new labels
$1,6,11,\dots,116$.}
\label{fig:residue}
\end{figure}


{\color{red}Need some better pictures here.}

A concrete run-through helps. Suppose Badarika lays down four cards in this order:
$37,\,7,\,94,\,61$. Their sum is $s=199$. Since $199$ leaves remainder $4$ on
division by $5$, the forced remainder is $(-4)\bmod 5 = 1$. The arrangement of
the four cards encodes the value $p=7$ (the mechanism comes next). So the
hidden card's new number is $5\cdot 7 + 1 = 36$. To recover the actual card,
start from $36$: the revealed card $7$ is at most $36$, so the answer becomes
$37$; the revealed card $37$ is now at most $37$, so the answer becomes $38$;
the cards $61$ and $94$ sit above $38$, so no more bumps. \textbf{The hidden
card is $38$.}

Now for the only step that might seem fiddly: turning an arrangement of four
cards into a number from $0$ to $23$, and back, without any factorial
arithmetic. Write $p = 6a + b$, where $a$ runs over $0,1,2,3$ and $b$ over
$0,1,2,3,4,5$; every $p$ in $0,\dots,23$ factors this way uniquely. Badarika
places the \emph{lowest} of her four cards into slot number $a$, counting slots
$0,1,2,3$ from left to right. She arranges the other three cards in the
remaining slots using the very same Low-Medium-High table from the basic
trick: the patterns \textsf{LMH}, \textsf{LHM}, \textsf{MLH}, \textsf{MHL},
\textsf{HLM}, \textsf{HML} encode $b=0,1,2,3,4,5$. To decode, Aalaya notes
which slot holds the lowest card (giving $a$), reads the three-card pattern in
the remaining slots (giving $b$), and computes $p = 6a + b$. 

The worked example closes neatly on itself (Figure~\ref{fig:slots}). The four
revealed cards are $37,7,94,61$. The lowest, $7$, sits in slot $1$, so $a=1$.
The other three, read left to right, are $37,94,61$—that is Low, High, Medium,
the \textsf{LHM} pattern, so $b=1$. Hence $p = 6\cdot 1 + 1 = 7$, exactly the
value the calculation required.

{\color{red}Add the factorial method for encoding a permutation as well.}

\begin{figure}[t]
\centering
\begin{tikzpicture}[x=1cm,y=1cm]
  \drawnum{0}{0}{37}
  \drawnum{1}{0}{7}
  \drawnum{2}{0}{94}
  \drawnum{3}{0}{61}
  % mark the lowest card's slot
  \draw[magHighlight, line width=1pt, -{Stealth[length=4pt]}] (1,0.95) -- (1,0.58);
  \node[font=\scriptsize, text=magHighlight] at (1,1.2) {lowest $\Rightarrow a=1$};
  \foreach \x/\lab in {0/0,1/1,2/2,3/3}{ \node[font=\scriptsize, text=black!60] at (\x,-0.8) {slot \lab}; }
  \node[font=\scriptsize, anchor=west] at (-0.5,-1.45)
     {others $37,94,61=\textsf{LHM}\Rightarrow b=1$, \ so $p=6a+b=7$};
\end{tikzpicture}
\caption{The encoding of the permutation: the slot of the lowest card gives $a$; the
\textsf{LMH} pattern of the other three gives $b$; and $p=6a+b$.}
\label{fig:slots}
\end{figure}

% \AuthorNote{%
% \textbf{A friendlier engine (a small proposal).} The classical exposition asks
% the performer to compute a permutation's rank in ``factorial base''—the most
% error-prone step at the table. The $p = 6a + b$ split above replaces that with
% two moves the duo already use in the $52$-card trick: \emph{spot the lowest
% card} and \emph{read an \textsf{LMH} pattern}. It is a genuine bijection
% between the $24$ orderings and $\{0,\dots,23\}$ (four slot-choices times six
% patterns), so it is just as valid as the textbook version, and it happens to
% reproduce the classic $37,7,94,61\mapsto 38$ example exactly. I have found
% nothing that removes the renumbering step entirely; whether a truly
% relabel-free decoding exists strikes me as a nice open question.
% }

One last observation. At $124$ cards the arithmetic comes out perfectly: the
number of five-card hands, $\binom{124}{5}$, equals the number of ordered
four-card messages, $124\cdot 123\cdot 122\cdot 121$. There is no slack at all: the correspondence between hands and messages is
a bijection, and not one of the $24$ orderings is spare.

\begin{artprobox}
    You are given the numbers:
    $10,\ 3,\ 16,\ 121,\ 42$. What will you hide? What will you show?
    % \footnote{Sort
    % the hand as $3,10,16,42,121$. The total is $192\equiv 2\pmod 5$, so hide the
    % card in position $2$, namely $16$. The visible cards are $3,10,42,121$, whose
    % sum is $176\equiv 1\pmod 5$, so the forced remainder is $4$. In the renumbered
    % deck the hidden card has label $16-2=14$, hence $p=(14-4)/5=2$. With
    % $p=6a+b$, this gives $a=0,b=2$: put the lowest visible card $3$ in slot $0$,
    % and arrange the remaining three in the pattern $\textsf{MLH}$. Thus one valid
    % display is $3,\ 42,\ 10,\ 121$.}
\end{artprobox}
    
\begin{artprobox}
The four numbers laid in a row are
$9,\ 40,\ 2,\ 88$. Name the hidden number.
% \footnote{The sum is
% $s = 139 \equiv 4$, so $(-s)\bmod 5 = 1$. The lowest number $2$ sits in slot
% $a=2$; the others $9,40,88$ are already in \textsf{LMH} order, so $b=0$ and
% $p = 6\cdot 2 + 0 = 12$. The new label is $5\cdot 12 + 1 = 61$; stepping past
% the four shown numbers gives the hidden card $64$.}
\end{artprobox}

\section*{Variations on the Theme}

The scheme we built has two moving parts: Badarika's choice of which card to
hide, and her arrangement of the four she shows. Both levers can be adjusted,
and each adjustment opens a different room.

\textbf{The coin flip (Elwyn Berlekamp).} Stretch the deck to $64$ cards. After
Badarika lays out four cards from a hand of five, $60$ cards remain unseen; the
hiding rule leaves the hidden card in a residue class of exactly
$60/5 = 12$. The four shown cards still arrange in $24$ ways, and $24$ is
exactly twice $12$. That spare factor of two carries one extra bit: Aalaya
names the hidden card \emph{and} announces the result of a coin an audience
member flipped in secret before the show. The same four-card layout does double
duty, and the audience sees nothing unusual.

\begin{artprobox}
Explain the magic number $64$. Show four cards of a deck of $D$ and ask why the
$24$ orderings can carry both the hidden card \emph{and} a coin bit only when
$D \leqslant 64$.\footnote{After four cards are shown, $D-4$ remain, and the
hiding rule pins the hidden card to a residue class of $(D-4)/5$ candidates.
Naming it \emph{and} a coin flip needs $24 \geqslant 2\cdot (D-4)/5$, that is
$D-4 \leqslant 60$, so $D \leqslant 64$—with equality exactly at $64$, where
$(D-4)/5 = 12$ and $2\cdot 12 = 24$.}
\end{artprobox}

\textbf{Face up, face down (Colm Mulcahy's ``Ups and Downs'').} Keep the
suit-and-pair logic, so again only a number from $1$ to $6$ must be sent.
Instead of encoding it through the ordering of three cards, Badarika encodes it
through their \emph{orientation}: \textsf{D} for face-down, \textsf{U} for
face-up. The six patterns \textsf{DDU, DUD, DUU, UDD, UDU, UUD} represent $1$
through $6$ (Figure~\ref{fig:updown}), and two patterns are left over. Since
\textsf{UUU} never appears, Aalaya can treat it as a private signal to switch
back to the original trick; the performer shifts modes mid-show with a casual
``Shall we make it harder and only show some of the cards?'' and nobody notices
the mechanism changed. Since \textsf{DDD} never appears either, at least one
card always lies face up, and that first face-up card can itself announce the
suit. The dedicated suit card becomes redundant: only \emph{three} cards need be
shown at all, and the fourth can be set aside with a theatrical flourish.

\begin{figure}[H]
\centering
\begin{tikzpicture}[x=1cm,y=1cm]
  % DDU = 1
  \udD{0.00}{0}\udD{0.30}{0}\udU{0.60}{0} \node[font=\scriptsize] at (0.30,-0.42) {$\textsf{DDU}=1$};
  % DUD = 2
  \udD{1.55}{0}\udU{1.85}{0}\udD{2.15}{0} \node[font=\scriptsize] at (1.85,-0.42) {$\textsf{DUD}=2$};
  % DUU = 3
  \udD{3.10}{0}\udU{3.40}{0}\udU{3.70}{0} \node[font=\scriptsize] at (3.40,-0.42) {$\textsf{DUU}=3$};
  % UDD = 4
  \udU{0.00}{-1}\udD{0.30}{-1}\udD{0.60}{-1} \node[font=\scriptsize] at (0.30,-1.42) {$\textsf{UDD}=4$};
  % UDU = 5
  \udU{1.55}{-1}\udD{1.85}{-1}\udU{2.15}{-1} \node[font=\scriptsize] at (1.85,-1.42) {$\textsf{UDU}=5$};
  % UUD = 6
  \udU{3.10}{-1}\udU{3.40}{-1}\udD{3.70}{-1} \node[font=\scriptsize] at (3.40,-1.42) {$\textsf{UUD}=6$};
\end{tikzpicture}
\caption{``Ups and Downs.'' Three cards, each face-up (\textsf{U}) or face-down
(\textsf{D}), send a number from $1$ to $6$. The patterns \textsf{UUU} and
\textsf{DDD} are never used—each becomes a hidden bonus.}
\label{fig:updown}
\end{figure}

\textbf{Hiding the tell (Mulcahy's ``Suit Alterations'').} A careful watcher of
the basic trick notices, after a few rounds, that the suit-giving card always
sits first. Here is the promised fix. Once Badarika has her four cards, she adds
their values and reduces modulo $4$ (using $4$ in place of $0$); the result
names \emph{which position} carries the suit, and the other three carry the
number as usual. For example, the displayed cards \cc{4}{S}, \cc{Q}{C},
\cc{5}{H}, \cc{10}{D} sum to $4+12+5+10 = 31 \equiv 3 \pmod 4$, so the third
card, the \cc{5}{H}, names the suit; the remaining three in \textsf{HLM} order
communicate $6$, and the hidden card is the \cc{8}{H}.

\textbf{When the volunteer chooses (after Gardner's ``Eigen's Value'').} Now the
volunteer, not Badarika, keeps one card back, so Badarika's best lever is gone. She
has only the ordering of four cards—$24$ arrangements—to point at one of $48$
unknowns, and $24$ can narrow $48$ down to at most two. The resolution is
stagecraft. With a fixed total order agreed in advance, the four displayed
cards single out two candidates (say the $15$th and $39$th in the residual
ordered list of $48$); Aalaya quietly brings one to the top of the deck and
the other to the bottom. Once the chosen card is named aloud, she turns over
either the top or the bottom card to reveal it. The deciding bit is smuggled in
by \emph{which end} she turns over, while every eye is on the volunteer.

\textbf{Pushing to the extreme (Tom Edgar).} With a ``one-way'' deck—backs with
no rotational symmetry—each card can point in four directions rather than two.
Two face-down cards of this kind, where one may also sit slightly atop the
other, produce $2\times 4\times 4 = 32$ distinct signals; combined with modular
arithmetic on the single revealed card's value, even \emph{two} cards suffice
for the $52$-card trick. There is even a one-card version using two
differently-coloured decks, where the relative placement and orientation of a
single card carry the whole message. These feel more like combinatorial puzzles
than performances, but they show how far the core idea stretches.

\textbf{The general pattern.} Behind every variation sits the same inequality.
Suppose the audience draws a hand of $n$ cards, Aalaya is shown $r$ of them,
and she must name the rest. A strategy exists exactly when
\[
\frac{(N-r)!}{(N-n)!} \;\geqslant\; n! ,
\]
where $N$ is the deck size. When $r = n-1$ (all but one card shown) the largest
workable deck satisfies $N = n! + n - 1$; for $n=5$ this gives $124$, and at
that maximum every hand of five matches exactly one arrangement of four—no
slack, no redundancy. Such a ``perfect'' trick is the card-magic cousin of a
perfect code.

Several questions sit at the edges of this picture. For which pairs $(n,r)$ does
a perfect deck size exist—one where hands and messages match with no remainder,
a clean Diophantine condition $\tfrac{(N-r)!}{(N-n)!} = n!$? How many
essentially different strategies are there for given $(n,r,N)$, once one strips
away relabellings of the deck? And whenever a strategy exists, is there always
one simple enough to carry in one's head, or does existence sometimes outrun any
hope of performance?

{\small
\vskip 0.05in
\affiliation[1.6em]{Associate Professor, CSE; IIT Gandhinagar}
\email{neeldhara.misra@gmail.com}
}
\end{document}
