◀ THE FOLD0ROOT.AI // WORLD II · CHEAT · THE KONAMI CODE◆ .dlw.fold
THE FOLD / CHEAT / THE KONAMI CODE / THE PERFECT SHUFFLE

THE PERFECT SHUFFLE

eight perfect shuffles back to the start
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
The faro shuffle is the card mechanic’s perfect riffle: cut the deck exactly in half and interleave the halves one card at a time. It looks like the ultimate randomizer and is precisely the opposite — a fixed permutation. Do the out-shuffle (top card stays on top) to a 52-card deck exactly eight times and the deck returns, card for card, to where it started. The engine is pure number theory: an out-shuffle sends interior position p to 2p mod 51, so the restoration count is the multiplicative order of 2 mod 51 = 8. Prefer the in-shuffle (top card buried)? Position maps to 2p+1 mod 53, order of 2 mod 53 is 52 — fifty-two perfect shuffles to come home. Magicians exploit the difference; so do parallel-processing networks, where the faro is the perfect-shuffle interconnect.

LIT verified live: simulating the actual interleave, 8 out-shuffles restore the 52-card deck (and none earlier), 52 in-shuffles restore it, and both counts equal the orders of 2 mod 51 and mod 53 computed independently (window.__faroshuffle). FIG no framing; the shuffles are performed on a real array and the modular orders computed separately.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at the-konami-code — the cheat: eight precise inputs and the system state resets, like a code entered at the title screen. AVAN (AI) built the instrument: the interleave simulation, the restoration counts, and the modular-order cross-check.

Credit as content: the faro/weave shuffle tradition; Alex Elmsley (out/in-shuffle theory); Diaconis, Graham & Kantor (the group theory). The weave: David names the reset code; I confirm 8 out, 52 in, and the orders behind both.
3 ONE DIMENSION
Card 1's journey under out-shuffles — doubling around the 51-cycle, home on the eighth.
4 TWO DIMENSIONS · INTERACTIVE
Shuffle step by step; the deck scrambles, scrambles — and snaps back on cue.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: the deck, home again after eight.
AVAN’s addition (the inverse-companion): don’t watch the cards — watch the exponent. The inverse of ‘how many shuffles to restore?’ is ‘the order of 2 in a hidden modulus’: 51 for out, 53 for in. Magenta is the scrambled middle of the journey; green is position doubling its way back to the start. A shuffle that was never random, only modular.
LIT Genuine faro/weave shuffle theory (Alex Elmsley; Diaconis, Graham & Kantor). Verified live: simulating the actual interleave, 8 out-shuffles restore the 52-card deck, 52 in-shuffles restore it, and both equal the orders of 2 mod 51 and mod 53 computed independently (window.__faroshuffle.ok).

FIG No framing — the shuffles are performed on a real array and the modular orders computed separately. The AVAN inverse — don't watch the cards, watch the exponent: the inverse of 'how many shuffles to restore?' is 'the order of 2 in a hidden modulus' — 51 for out, 53 for in. Magenta is the scrambled middle of the journey; green is position doubling its way back to the start. A shuffle that was never random, only modular.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE KONAMI CODE · David Lee Wise (ROOT0), with AVAN