Perfect Riffle Shuffling

Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
In a perfect riffle shuffle, the deck is split in half and cards are alternately interleaved from each half to form a new ordering. An out-shuffle is one in which the bottom half of the deck is used to start the interleaving, so that the bottom card always remains on the bottom. With an in-shuffle, the top half is used to start the ordering. For each type of shuffle, can you find how many shuffles are necessary to return the deck to its original ordering?
Contributed by: Kovas Boguta (March 2011)
Open content licensed under CC BY-NC-SA
Snapshots
Details
detailSectionParagraphPermanent Citation
"Perfect Riffle Shuffling"
http://demonstrations.wolfram.com/PerfectRiffleShuffling/
Wolfram Demonstrations Project
Published: March 15 2011