This card shuffler, instead of randomizing the positions of cards in the deck, always rearranges any given set of cards into the same new order.
If for example one puts all the hearts into the shuffler, in the order A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, and runs that through the shuffler first once, and then, without rearranging the cards, runs it through again, the resulting sequence after the second shuffle is always:
10, 9, Q, 8, K, 3, 4, A, 5, J, 6, 2, 7
The question is:
What was the order of the cards after the first run through this non-randomizing shuffler?
From the Skeptics' Guide to the Universe
podcast episode of June 22, 2013 (episode 414).
Let's look for subcycles.
The A is in the 8 spot, so A and 8 are in the same cycle.
The 8 is in 4 spot, so 4 is in the same cycle.
The 4 is in the 7 spot, so 7 is in the same cycle.
The 7 is in the K spot, so K is in the same cycle.
The K is in the 5 spot, so 5 is in that same cycle.
The 5 is in the 9 spot, so 9 is in that same cycle.
The 9 is in the 2 spot, so 2 is in that same cycle.
The 2 is in the Q spot, so Q is in that same cycle.
The Q is in the 3 spot, so 3 is in that same cycle.
The 3 is in the 6 spot, so 6 is in that same cycle.
The 6 is in the J spot, so J is in that same cycle.
The J is in the 10 spot, so 10 is in that same cycle.
The 10 is in the A spot, so the cycle is complete.
The cycle contains all 13 cards, so Brian's method can be applied, yielding my original solution, which turns out to be the only solution.
Consider my earlier example, which after two shuffles looked as follows:
3 4 A 2 7 8 9 10 J Q K 5 6
We can determine, using a similar method, that there is a cycle of 4 (A234) and a cycle of 9 (56789 10 JQK). A variation of Brian's method can be used to solve the cycle of 9, by applying 4 more times (instead of 6) to arrive at the position after 1 shuffle of 678910JQK5. However, the subcycle of 4 is even-numbered, so no variation of Brian's method can be used to solve it. If fact, there is more than one solution. After 1 shuffle, A234 can be either 234A or 4A23.
There is a unique solution only if all subcycles are odd and at most one is of length 1:
3 + 3 + 7 (repeats after 21)
3 + 5 + 5 (repeats after 15)
13 (repeats after 13)
1 + 3 + 3 + 3 + 3 (repeats after 3)
1 + 5 + 7 (repeats after 35)
Edited on July 25, 2013, 9:37 am