The Card-Shuffle Sequence
[diversions]
Warning: math geek content coming up.
Imagine you were a card-shuffling master and you could consistently do "perfect" shuffles, that is, you can split a deck right down the middle and merge them back together such that each subsequent card is taken from alternating halves. For example, if you were shuffling a small deck of ten cards:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Then after one shuffle, they would be in this order:
6, 1, 7, 2, 8, 3, 9, 4, 10, 5
Now, what would happen if you shuffled again?
3, 6, 9, 1, 4, 7, 10, 2, 5, 8
And if you kept on going? Well, after three more shuffles you would have:
10, 9, 8, 7, 6, 5, 4, 3, 2, 1
Surprised? Maybe, maybe not. Well, it shouldn't be surprising that after five more shuffles, you would be back to your original order:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Cool, eh? If you're a perfect shuffler, a ten-card deck will return to its original order after ten shuffles.
Other examples? Two cards (obviously) get restored after two shuffles; four cards, four shuffles. If you think you're seeing a simple pattern, though, think again. Six cards requires three shuffles. Eight cards requires six shuffles.
If we line up the number of shuffles required to return a deck to its original order for increasing even deck sizes, it forms a strange sequence of numbers. We'll just ignore decks with an odd number of cards. Here are the first 26 (for decks of sizes 2 through 52):
2, 4, 3, 6, 10, 12, 4, 8, 18, 6, 11, 20, 18, 28, 5, 10, 12, 36, 12, 20, 14, 12, 23, 21, 8, 52, ...
I'm quite fascinated by this sequence. As you can see, it's not monotonically increasing: sometimes, a larger number of cards will require fewer shuffles to return it to its original order. Sometimes, the deck will be in reverse order at the half way point, sometimes not. Sometimes, it's an odd number of shuffles so there is no half way point. I think it must have something to do with prime factorizations, but I don't get it. It's deliciously mysterious.
By the way, 126 cards requires only 7 shuffles. Cool!

