\documentclass[11pt]{article} \usepackage[margin=0.80in]{geometry} \usepackage[T1]{fontenc} \usepackage{lmodern,amsmath,amssymb,amsthm,booktabs,array,xcolor,hyperref} \hypersetup{colorlinks=true,urlcolor=blue!55!black,linkcolor=blue!45!black} \newtheorem{theorem}{Theorem} \newtheorem{lemma}{Lemma} \newtheorem{proposition}{Proposition} \newcommand{\CC}{\mathrm C} \newcommand{\JJ}{\mathrm J} \newcommand{\QQ}{\mathrm Q} \newcommand{\KK}{\mathrm K} \renewcommand{\AA}{\mathrm A} \newcommand{\word}[1]{\texttt{#1}} \setlength{\parskip}{5pt} \setlength{\parindent}{0pt} \emergencystretch=2em \title{The unique shortest rank-state cycle\\in Beggar-My-Neighbour\\\large Six tricks and 38 individual plays} \author{Christopher D. Long} \date{19 November 2026} \begin{document} \maketitle \begin{abstract} Under chronological pickup and winner-led play, the minimum primitive rank-state cycle lengths for the standard 52-card inventory are six completed tricks and 38 individual plays. One cycle attains both minima and is unique under either criterion, up to cyclic phase and exchange of players. Its $30$--$22$ witness has a short word certificate, and a $26$--$26$ deal enters it after one trick. The trick-period proof excludes 1,201 face itineraries below six tricks and classifies all 21,407 six-trick itineraries. For the global individual-play result, an elementary bound reduces the problem to at most 18 tricks. Two independently implemented enumerators agree on all 43,808 candidate itineraries through 38 plays; exact integer gap constraints leave one itinerary and one rank-and-gap model. A short modular-arithmetic argument independently proves rigidity of that surviving model. With named players there are two oriented cycles, each with six boundary states and 181 backward-reachable rank states, including 19 balanced starts. We also classify period-four deck sizes and prove that fixed-period deck-size sets are semilinear. \end{abstract} \section{Introduction and conventions} The classical card game Beggar-My-Neighbour (also called Beggar-Your-Neighbor) was studied as a problem of nontermination for many decades; see the problem statement of Paulhus~\cite{paulhus} and the historical account of Casella et al.~\cite{casella}. Casella and collaborators constructed a nonterminating standard-deck game with a 62-trick cycle, solving Conway's anti-Hilbert problem. More recent computational and dynamical investigations include Andorno et al.~\cite{andorno}. We minimize the primitive rank-state cycle length under the same deterministic rules and standard deck inventory, using both completed tricks and individual card plays as measures of time. The minima are six tricks and 38 plays. The same cycle uniquely attains either minimum, up to cyclic phase and player exchange. In particular, allowing more than six tricks yields neither a shorter individual-play cycle nor an additional cycle with 38 plays. We distinguish these primitive periods from the transient needed to enter a cycle and from periods that track the suits or physical identities of all cards. The global exclusions and classifications are computer-assisted, using an exhaustive face-itinerary reduction and exact integer gap constraints. Independent enumeration implementations, reproducible source code, and two solver interfaces support the computations. The upper-bound witness is an exact hand-checkable word identity. Uniqueness within the surviving face itinerary also has an elementary modular-arithmetic proof; that positive-case argument is separate from the computer-assisted exclusion of every other itinerary. Write $\CC$ for any ordinary card and use $\JJ,\QQ,\KK,\AA$ for cards requiring payments of $1,2,3,4$, respectively. A new face card interrupts the current payment and starts its own payment. A successful claimant appends the entire table pile to the bottom of their hand in chronological play order and leads the next trick. Hands are queues, with the next card on the left. A state here is $(H_A,H_B,\ell)$ at an empty-table boundary immediately after collection: both ordered words and the next leader are included. Equal face ranks are identified, as are all ordinary cards. Let $T$ be the completed-trick map on states for which another trick can be completed. The primitive period in tricks is the least positive $p$ with $T^p(s)=s$. Its individual-play period $L$ is the number of cards played during those $p$ tricks. Cyclic changes of the starting boundary leave both quantities unchanged. \begin{theorem}[Both minima and their unique attaining cycle]\label{thm:main} For inventory $\CC^{36}\JJ^4\QQ^4\KK^4\AA^4$, \[ \boxed{p_{\min}=6\text{ tricks},\qquad L_{\min}=38\text{ individual plays}.} \] Both minima are taken over all nonempty hand splits. Up to cyclic phase and exchange of players, exactly one cycle has six tricks, and exactly one cycle has 38 individual plays; these are the same cycle. A $30$--$22$ state attains the minima, and a $26$--$26$ deal reaches it after one trick. Thus both minima are also attained as eventual periods from balanced deals. With player names fixed, the attaining cycles comprise exactly two oriented orbits, each with six completed-trick boundary states. \end{theorem} The existence proof is the explicit calculation in the next section. The trick-period exclusions and classification are given below; the global individual-play classification is in Section~\ref{sec:global-plays}, with elementary rigidity in Section~\ref{sec:rigidity}. The theorem concerns the minimum over all splits and the attainable eventual periods from balanced deals. It does not assign a minimum to every prescribed boundary split or minimize periods that distinguish all 52 physical cards. \section{A six-trick cycle with a word certificate}\label{sec:witness} Player A leads from the following hands: \[ \begin{aligned} H_A={}&\KK\CC\AA\CC^5\QQ\CC^3\QQ\CC\AA\CC^3\QQ \KK\CC\AA\CC^5\QQ\CC^2,\\ H_B={}&\CC\JJ\CC\KK\CC\JJ\CC^2\AA\KK\CC^5\JJ\CC^4\JJ\CC. \end{aligned} \] For copying into the verifier, the expanded words are \begin{verbatim} A: KCACCCCCQCCCQCACCCQKCACCCCCQCC B: CJCKCJCCAKCCCCCJCCCCJC \end{verbatim} Their lengths are 30 and 22. Together they contain 36 ordinary cards and four copies of each face rank. \subsection{The six tricks} In the table, a pile is written in chronological order. The two play counts record how many cards each player contributes to that pile. \begin{center} \small \begin{tabular}{@{}c c r r l c c@{}} \toprule Trick & Leader & A plays & B plays & Collected pile & Winner & Next split\\ \midrule 1&A&2&2&$P_1=\KK\CC\JJ\CC$&B&$28$--$24$\\ 2&B&4&2&$P_2=\CC\AA\KK\CC^3$&B&$24$--$28$\\ 3&B&2&2&$P_3=\CC^2\JJ\CC$&B&$22$--$30$\\ 4&B&7&8&$P_4=\CC\QQ\CC\AA\CC^3\QQ\KK\CC\AA\CC^4$&A&$30$--$22$\\ 5&A&3&2&$P_5=\CC^3\JJ\CC$&B&$27$--$25$\\ 6&B&1&3&$P_6=\CC\QQ\CC^2$&A&$30$--$22$\\ \bottomrule \end{tabular} \end{center} For example, the fourth trick has the following sequence of face cards: player A's queen, B's ace, A's queen, B's king, A's ace. The gaps between them are $1,3,0,1$, so every interruption is legal; B then pays four ordinary cards. The complete card-by-card trace is in the accompanying JSON and is also printed by the verifier. \subsection{Why both queues return} Set \[ U=\KK\CC\AA\CC^5\QQ\CC^2,\qquad V=\CC\JJ\CC. \] The starting words have the useful factorizations \[ \boxed{H_A=UP_4P_6,\qquad H_B=VP_1P_2P_3P_5.} \] During the six tricks each player plays exactly 19 cards. No collected card has yet reached the front of either queue: A starts with 30 cards and B with 22. Their unplayed original suffixes are precisely $U$ and $V$. Their captured piles are appended in the orders shown in the boxed identities. Consequently \[ T^6(H_A,H_B,A)=(UP_4P_6,\ VP_1P_2P_3P_5,\ A) =(H_A,H_B,A). \] The pile lengths are $4,6,4,15,5,4$, totaling 38 card plays. The winner word $BBBABA$ has least period six. A shorter state period dividing six would force the winner word to have that shorter period, so the displayed state has primitive period exactly six. \section{An equal deal enters the cycle after one trick} The following two words both have length 26; A leads: \begin{verbatim} A: ACCCQKCACCCCCQCCCQCACCCQKC B: CCCCCJCCCCJCKCJCCAKCCCCCJC \end{verbatim} A plays an ace, B pays four ordinary cards, and A collects $\AA\CC^4$. The resulting hands are \begin{verbatim} A: CCCQKCACCCCCQCCCQCACCCQKCACCCC B: CJCCCCJCKCJCCAKCCCCCJC \end{verbatim} with A again leading. This is exactly the boundary following trick 4 in the six-cycle. Thus the equal deal has a one-trick transient followed by primitive period six. It is not necessary for a $26$--$26$ boundary itself to occur on the periodic orbit. \section{Word equations for a returning FIFO state} The central combinatorial simplification is independent of the card rules. Suppose one player begins with a queue $S$, plays a chronological word $D$ during a proposed period, and collects a concatenated word $R$ of captured piles during that period. If no collected cards have reached the front yet, then the return equation is $SR=DS$. More generally, the same equation holds as a concatenation of the chronological queue flow when $D$ is taken to be the entire word removed from the queue during that interval. \begin{lemma}[Queue return equation] Let $S,D,R$ be finite words with $D$ nonempty and $|D|=|R|$. Then \[ SR=DS\quad\Longleftrightarrow\quad S=\operatorname{pref}_{|S|}(D^\infty),\qquad R=\operatorname{rot}_{\,|S|\bmod |D|}(D). \] \end{lemma} \begin{proof} The equality $SR=DS$ says that $D$ is a prefix of $S R$ and that deleting this prefix and adding $R$ returns to $S$. Iterating the word equality yields that $S$ is a prefix of the infinite periodic word $D^\infty$. More explicitly, write $|S|=q|D|+r$ and $D=XY$ with $|X|=r$. Necessarily $S=D^qX$ and $R=YX$; conversely, then $SR=D^qXYX=D^{q+1}X=DS$. \end{proof} This lemma imposes only FIFO closure; legality of the intervening face-card challenge sequence must still be verified. In our six-trick witness, each player plays 19 cards, and their original queues are longer than 19. The packet identities in Section~\ref{sec:witness} instantiate the equation without replaying collected cards during the cycle. \section{Backward accessibility from a balanced deal} For the six-trick orbit, the complete inverse image under the completed-trick map can be enumerated directly, without a solver. Given a current state and its most recent winner, the most recent captured pile is a suffix of the winner's hand. For each possible nonempty suffix and either preceding leader, we recover the unique prospective ownership sequence from the face-payment rules; a candidate predecessor is accepted only if one forward trick reproduces the current state. Iterating these operations from all six cycle states gives the entire backward component. \begin{proposition}[Backward component of the displayed orbit] The six-trick orbit has exactly 181 backward-reachable rank states, including the six periodic states. Exactly 19 have a 26--26 hand split. The maximum distance from a backward-reachable state to the cycle is four completed tricks. Among states with player A leading, the A-hand sizes include every integer from 20 through 33. \end{proposition} The proposition is certified by the standard-library script \word{backward\_component.py}, which reconstructs all predecessors and forward-replays each one. Combining it with the global six-trick lower bound shows that an eventual period of six can be attained from all A-leading splits $20$--$32$ through $33$--$19$, and the explicit balanced deal above enters the cycle in one trick. The script also records the complete list of 19 balanced starts for independent inspection. These counts refer to the displayed named-player orientation. Section~\ref{sec:six-classification} accounts for its player-swapped copy and both components together. The global uniqueness theorem identifies these as all orbits attaining either minimum. \section{Why the face-itinerary search is exhaustive}\label{sec:faces} \begin{lemma}[Faces and winners] On a periodic orbit, both players win at least once, and each hand contains a face card at every completed-trick boundary. Within a trick the owners of successive face cards alternate. The final face card belongs to the winner. \end{lemma} \begin{proof} If a player never wins, their finite hand loses cards and cannot return. If a hand ever has no face card, it cannot win another pile and hence cannot acquire another face card. It therefore cannot lie on a periodic orbit. After a face is played, the other player must answer; any interrupting face is consequently owned by the other player. The last face makes the successful claim when the ensuing payment is completed. \end{proof} Suppose trick $i$ has winner $w_i$ and $m_i=2k_i+e_i$ face cards, with $e_i\in\{0,1\}$. Alternation implies that the loser contributes $k_i$ faces, and the winner contributes $k_i+e_i$. Hence the winner gains exactly $k_i$ faces. The loser must retain a face; no face in the pile can be used again before collection. Thus \[ 1\le m_i\le15,\qquad 0\le k_i\le7. \] Face balance over a return requires \[ \sum_{i:w_i=A} k_i=\sum_{i:w_i=B}k_i. \] For fixed $p$, the exhaustive enumeration is therefore finite: \begin{enumerate} \item Enumerate nonconstant binary winner words of length $p$, up to cyclic rotation and exchange of the players. Choose a representative ending in A, so the initial leader is A. \item Enumerate $k_i\in\{0,\ldots,7\}$ and $e_i\in\{0,1\}$ satisfying the displayed bounds and face balance. \item Try every initial A-face count $a=1,\ldots,15$. Give the 16 faces distinct temporary labels and simulate their FIFO movement. Given $w_i$ and $m_i$, the owner of face $j$ of trick $i$ is forced by alternation. Reject impossible queues and any boundary with no face in one hand. \item At a possible return, flatten the two face queues into 16 slots. This gives a permutation of the initially labelled faces. Every permutation cycle must be monochromatic in rank. Its cycle sizes must therefore fit into four bins, each of total weight four. \item For every surviving face itinerary, solve the exact ordinary-gap constraints described next, with total ordinary count 36. \end{enumerate} This covers every initial card split. It enumerates the number of faces in each initial hand, but puts no restriction on the number of ordinary cards assigned to either hand beyond nonnegativity and their combined inventory. \section{Exact ordinary-gap constraints}\label{sec:gaps} With $a$ faces in A's hand, write its word as \[ \CC^{g_0}f_1\CC^{g_1}f_2\cdots f_a\CC^{g_a}, \] and similarly for B. The two hands together have exactly $16+2=18$ gaps. All initial gaps are nonnegative integers. For the standard deck their sum is 36. The gap model implements the following three operations exactly. \paragraph{Before the first face.} Let $x$ be the current leading gap of the player who will expose the first face. Let $\delta=0$ if this player is the leader and $\delta=1$ otherwise. The other player's leading gap must be at least $x+\delta$; these ordinary cards are consumed. The pile begins with $2x+\delta$ ordinary cards. \paragraph{Interruptions and final payment.} After a face of penalty $r$, a prescribed interrupting face can occur after a leading gap $g$ exactly when $0\le g0$ is the penalty of label $j$. The symbol $\Delta$ denotes final minus initial gap. \begin{center} \small \begin{tabular}{@{}r p{2.35in} l@{}} \toprule A-faces & Face counts in the three tricks & Required gap difference\\ \midrule 11 & $(1,8,8),(3,6,8),(5,4,8),(7,2,8)$ & $\Delta a_4=-2b_0-b_5-r_{15}-1<0$\\ 9 & $(2,6,9),(4,4,9),(6,2,9)$ & $\Delta b_0=-a_0-r_8<0$\\ 13 & $(4,8,13),(6,6,13)$ & $\Delta b_0=-a_0-r_{12}<0$\\ 11 & $(7,1,7)$ & $\Delta b_4=b_4+r_{14}>0$\\ \bottomrule \end{tabular} \end{center} Each contradicts the required return of that gap. \subsection{An exact classification for period four} \begin{proposition} With four copies of each face rank and $c$ ordinary cards, a four-trick cycle exists if and only if \[ \boxed{c=104+31n,\qquad n\in\mathbb Z_{\ge0}.} \] \end{proposition} The complete face enumeration and unrestricted gap check leave only one four-trick itinerary, up to the symmetries already used: winners $BABA$, one face per trick, and initial face words $(rs)^4$ and $(tu)^4$. Here $(r,s,t,u)$ is any permutation of the four penalties. This finite exclusion is computer-assisted. The remaining family can be solved algebraically. Let $q$ be B's initial leading ordinary gap. Define \[ \begin{aligned} E&=2q-s+2t+1,& O&=2q+r-2s+2u+1,\\ D&=2q+2r-2s+t+1,& F&=2q+u+1. \end{aligned} \] Return forces the two gap vectors to be \[ g_A=(E,O,E,O,E,O,E,O,s),\quad g_B=(q,D,F,D,F,D,F,D,u). \] All legal-play inequalities reduce to \[ q\ge0,\qquad q+r\ge s,\quad q+t\ge s,\quad q+u\ge s. \] Since $(r,s,t,u)$ permutes $1,2,3,4$, these are equivalent to $q\ge s-1$. Adding the gaps gives \[ c=135+31(q-s)=104+31n,\qquad n=q-s+1\ge0. \] Conversely the displayed gap words play as prescribed for every $n\ge0$ and every rank permutation. Their period is four, since period two is impossible for this face inventory. In particular, the standard count $c=36$ is excluded by a substantial margin. \section{The six-trick pattern is rigid}\label{sec:rigidity} Suppress ordinary cards in the six-cycle and write the face words as \[ H_A:\ xyzzyzxyz,\qquad H_B:\ wxwyxww. \] The trick face counts are $(2,2,1,5,1,1)$, with winners $BBBABA$. The physical-face return permutation has four cycles of length four. Thus $(x,y,z,w)$ must permute $(1,2,3,4)$ if the inventory has four of each rank. \subsection{An elementary proof for the standard inventory} Write A's ordinary gaps as $(a_0,\ldots,a_9)$ and B's as $(b_0,\ldots,b_7)$. The linear gap-return equations have rank 17. With $u=b_6$, all their solutions are the affine formulas in Appendix~\ref{app:affine}. Adding those 18 formulas gives the following identity for the total ordinary count $C$: \begin{equation}\label{eq:rigidity-count} 12C=115u+34x+2y-100z+125w-63. \end{equation} \begin{proposition}[Standard-inventory rigidity]\label{prop:rigidity} For the prescribed face itinerary, the standard inventory admits exactly one rank-and-gap realization. It has $(x,y,z,w)=(3,4,2,1)$ and $u=4$, and is the witness of Section~\ref{sec:witness}. \end{proposition} \begin{proof} Substitute $C=36$ and $w=10-x-y-z$ in \eqref{eq:rigidity-count}. This gives \[ 115u=91x+123y+225z-755. \] Because $u$ is an integer, \[ -24x+8y-5z\equiv65\pmod{115}. \] The bounds $1\le x,y,z\le4$ imply \[ -108\le-24x+8y-5z\le3. \] The only integer in this interval congruent to 65 modulo 115 is $-50$. Hence $24x-8y+5z=50$. Reduction modulo 8 forces $z=2$, leaving $3x-y=5$. The possibilities in $\{1,2,3,4\}$ are $(x,y)=(2,1)$ and $(3,4)$; distinctness from $z=2$ excludes the first. Consequently \[ \boxed{(x,y,z,w)=(3,4,2,1)=(\KK,\AA,\QQ,\JJ),\qquad u=4.} \] The affine formulas now fix all gaps: \[ g_A=(0,1,5,3,1,3,0,1,5,2),\qquad g_B=(1,1,1,2,0,5,4,1). \] These are nonnegative integers totaling 36. The direct play in Section~\ref{sec:witness} proves legality and return, establishing existence as well as uniqueness. \end{proof} The standard-library checker \word{check\_algebraic\_rigidity.py} independently derives the 18 return equations by symbolic FIFO transport, verifies the physical face orbits, performs exact rational row reduction, checks the complete affine parameterization and \eqref{eq:rigidity-count}, and verifies the modular deduction and a direct labelled-face replay. This positive-case rigidity proof does not depend on an SMT solver's second-model exclusion. \subsection{Rigidity even with unrestricted ordinary count} For this particular itinerary, \emph{without specifying an ordinary-card count}, there is only one legal periodic realization: $(x,y,z,w)=(3,4,2,1)$ and the 36 ordinary cards displayed above. The accompanying \word{check\_rigidity.py} verifies this by exact rational arithmetic and ordinary forward play, without an SMT solver. Here is a finite bound underlying that check. Let $u=b_6$ be B's gap before its last face. Linear return equations express every gap in $u,x,y,z,w$; in particular \[ a_0=\frac{5u-5w+2x-2y-8z+3}{12}. \] The second trick requires $a_0