An in shuffle is a type of perfect shuffle done in two steps:
If this shuffle moves the top card to be 2nd from the top then it is an in shuffle, otherwise it is known as an out shuffle.
For simplicity, we will use a deck of six cards.
The following shows the order of the deck after each in shuffle. Notice that a deck of this size returns to its original order after 3 in shuffles.
Step | Top Card |
2 | 3 | 4 | 5 | Bottom Card |
---|---|---|---|---|---|---|
Start | ||||||
1 | ||||||
2 | ||||||
3 |
The number of in shuffles required to return a deck of cards of even size N, to original order is given by the multiplicative order of 2 modulo (N + 1).
For example, for a deck size of N = 2, 4, 6, 8, 10, 12 ..., the number of in shuffles needed are: 2, 4, 3, 6, 10, 12, 4, 8, 18, 6, 11, ... (sequence A002326 in OEIS).
For a standard deck of 52 playing cards, the number of in shuffles required to return the deck to its original order is 52. This phenomenon occurs because 2 is a primitive root modulo 53, the number of cards plus one. In general, for a deck of n cards, the number of in shuffles required to return the deck to its original order is n when 2 is a primitive root modulo n + 1, and is smaller than n otherwise. According to Artin's conjecture on primitive roots, it follows that there are infinitely many deck sizes which require the full set of n shuffles.