An in-shuffle is a riffle shuffle in which a deck is divided into two equal halves whose cards are interleaved in their original order. Reading the shuffled deck from top to bottom, the first card comes from the bottom half. Using an in-shuffle, a deck originally arranged from top to bottom as 1 2 3 4 5 6 7 8 would become 5 1 6 2 7 3 8 4. The ordering of a deck of 52 cards after an in-shuffle is given by 27, 1, 28, 2, 29, 3, ... (OEIS A059952).
In general, in-shuffling a deck of cards once moves card
to the position originally occupied by the
th card (mod
) (Conway and Guy 1996). Therefore, in-shuffling a deck
of
cards
times when
is prime results in the
original card order. This means that an ordinary deck of 52 cards is returned to
its original order after 52 in-shuffles. The numbers of in-shuffles needed to return
a deck of
,
4, ... cards to its original order are 2, 4, 3, 6, 10, 12, 4, 8, 18, 6, 11, ... (OEIS
A002326), which is simply the multiplicative
order of 2 (mod
).