The Topswops Machine

John Conway's one-rule card game: read the top card, flip over that many. Repeat until the ace surfaces. Trivial to state — and nobody can tell you, without running it, how long it takes, which decks last longest, or which decks no flip could ever have produced. So run it.

Companion film — 2:30 The longest 7-card game played card by card (the deck [4,7,6,2,1,5,3] lasts 16 flips — the most any 7-card deck can, A000375), then all 5,040 deals tallied, the Garden-of-Eden count (= A000255(6)), and the three sequences laid side by side. Every figure on screen is computed live from the same engine the page runs; the melody is that longest game, played note-per-flip. Recomputed by research/topswops/verify.mjs (9/9).

Deal, then flip

Press Shuffle to deal a deck.

The rule: if the top card is k, reverse the order of the top k cards. If it is 1 (the ace), stop. Conway proved this always stops.

What just happened, counted

For a deck of 7 cards there are 5040 possible deals. The machine below played every one of them in your browser and counted.

Flip-count distribution over all deals (tallest bar = the longest-lasting decks):

0 flipsmax

The decks no flip can produce

Every flip lands the machine on some new deck. Run it backwards: are there deals that are never the result of a flip — that can only ever be a starting hand? There are. They have a clean signature.

A deck is the result of a flip exactly when some card k sits in position k below the top (reverse the first k and it lands there). So the unreachable decks are precisely the permutations with no card in its own place except possibly the top. Counting those gives a sequence the catalogue already knows by another name — A000255, Euler's fixed-point-free count. A new bridge between a card game and an 18th-century permutation count.

Three sequences fall out

Tabulate those counts as n grows and you get integer sequences. Two are already catalogued. One — the total number of flips across all deals — was not in the OEIS when this page was built (checked 2026-06-24), so it is staged as a new entry with its working shown.

Verified exactly (BigInt / exhaustive). New column in gold.
nmax flips
A000375
longest-lasting
decks A123398
total flips
(new)
unreachable
A000255(n-1)

The same code reproduces the catalogued columns (max flips, longest-lasting decks) exactly — that calibration is why the new column can be trusted. Reproduce it all with node research/topswops/verify.mjs (9/9).

The check

Every number on this page was recomputed in your browser by exhaustively playing all n! deals (for n ≤ 9 automatically; n = 10 on request), and it agrees with the values verified offline.

Calibration: the live enumeration reproduces OEIS A000375 (max flips: 0, 1, 2, 4, 7, 10, 16, 22, 30, 38, 51, 65, 80) and A123398 (number of maximizing decks) exactly — so only the total-flips column is claimed new.

The new sequence: total flips over all deals = 0, 1, 6, 38, 265, 2115, 18508, 180260, 1911505, 22169434, 277931375, 3758940272, 54349566758 (n = 1..13), confirmed absent from the OEIS at build time. The bridge: unreachable decks = A000255(n−1), proven three independent ways (flip-map preimages, the no-fixed-point characterization, and A000255's recurrence) in research/topswops/verify.mjs.

Honest apparatus. Conway's termination theorem is cited, not re-proved here. The mean number of flips appears to grow roughly linearly in n, but no asymptotic is claimed — only the exact totals shown. "Absent from OEIS" is a dated catalogue claim, not a theorem of non-existence. Staged for Zenodo + independent human authorship per OEIS's AI-submission policy; not auto-submitted.