A deterministic card table
Eight Perfect Shuffles
A perfect out-shuffle is the opposite of random: it sends every position through a fixed doubling rule. Shuffle the live deck and watch all 52 cards return after eight exact out-shuffles, trace any card through the formula, then use binary in/out instructions to steer the top card to any requested position. A 24-card packet exposes the deeper surprise and a correction: its out-shuffle returns after 11, while the much larger group generated by both perfect shuffles is a cited theorem whose order arithmetic is checked live.
I · The returnCut exactly. Interlace exactly.
An out-shuffle splits the deck in half and alternates the cards while leaving the top and bottom cards outside the weave. Press once. The colors are original positions, so the interlacing is visible before the labels are readable.
Live 52-card deck
0 out-shuffles
Computing the return length…
Open the complete one-shuffle position map
Label positions from the top, starting at zero. For every card except the bottom one, the out-shuffle is multiplication by two modulo one less than the deck size. The bottom card is fixed separately. Repeating the shuffle repeats the multiplication. The deck returns when a power of two first leaves every position unchanged.
The in-shuffle changes which half contributes first. Its clean coordinate is one more than the visible position, so the modulus becomes one more than the deck size. Switch the control above and the page rebuilds the whole permutation. The longer return is not animated by assertion. You can run it.
II · The steering wheelWrite the destination in binary
The obvious dismissal is that eight is a cute coincidence about one deck size. Alex Elmsley's deeper observation turns the same doubling into control. Read a target's binary digits from left to right. A one means in-shuffle. A zero means out-shuffle. Each move appends that digit to the tracked card's position.
zero-indexed, top is 0
Binary instruction tape
Preparing the binary instruction…
Checking every possible target…
This is not a shortcut that works for only the displayed target. The green audit line exhaustively constructs and simulates the binary instruction for every legal target whenever the page loads. The offline verifier independently shuffles complete arrays, then asks where the original top card landed.
III · The exceptional packetTwenty-four cards do something else
The group generated by both perfect shuffles is much richer than the return time of either generator. A 24-card packet is an exceptional case in the classification by Persi Diaconis, Ronald Graham, and William Kantor. First, test the packet's plain out-shuffle.
Live 24-card packet · out-shuffle only
0 shuffles
Computing…
Computing the packet return…
Now add the in-shuffle and consider every arrangement reachable by any finite word in the two moves. That set is the shuffle group. Diaconis, Graham, and Kantor identify the 24-card case as a semidirect product involving the sporadic simple Mathieu group M12. The identification is their theorem. The live arithmetic below checks the resulting order, not the theorem that names the group.
Computed here
The two position permutations, their return times, every Elmsley landing, both 24-card residues, and the multiplication of the cited factors.
Cited, not reproved
The identification of the 24-card shuffle group with 2^11 : M12, and the published order of M12.
The check · rebuilt in this browser
These rows are filled only after the page constructs the permutations and runs the finite checks. The same algorithms live in the dependency-free Node verifier.
- 52-card out
- Computing…
- Out cycles
- Computing…
- 52-card in
- Computing…
- Elmsley
- Computing…
- 24-card correction
- Computing…
- Group arithmetic
- Computing…
Uncertainties and free choices
- No fitted model is used. These are finite permutations under an explicitly chosen convention. A physical shuffle is called perfect only if its cut and alternation match that ideal exactly.
- Indexing is a choice with consequences. This page numbers positions from zero at the top. Out leaves top and bottom fixed and uses modulus computing. In sends the top card to position one and uses modulus computing.
- Factory order is only a visual choice. The suit order, colors, card chosen by the trace slider, and animation timing do not enter the mathematics. An identity permutation restores any starting arrangement.
- The exceptional group claim is source-dependent here. This page does not enumerate nearly two hundred million arrangements and does not independently prove the Mathieu-group identification. It attributes that result to DGK and checks only the order arithmetic from cited factors.
- No general shuffle-group size is claimed. DGK's classification varies with packet size and contains exceptional cases. Only the 24-card case is named on this page.
Sources and reproducibility
- Persi Diaconis, Ronald L. Graham, and William M. Kantor, “The mathematics of perfect shuffles,” Advances in Applied Mathematics 4, no. 2 (1983), 175-196. This is the primary source used for the shuffle definitions, the modular-order lemma, and the exceptional 24-card group.
- Alex Elmsley, “The Mathematics of the Weave Shuffle,” The Pentagram 11, nos. 9-11 (June-August 1957), 70-71, 77-79, 85. The binary steering construction is also described by Persi Diaconis and Ron Graham, “The Solutions to Elmsley's Problem,” Math Horizons 14, no. 3 (2007), 22-27.
- The published order of M12 is cross-checked against the GAP Character Table Library entry for M12.
Repository check: node research/eight-perfect-shuffles/verify-eight-perfect-shuffles.mjs.
It rebuilds the permutations, decomposes every out-shuffle orbit, simulates all target
instructions on full decks, and fails on any mismatch.