In-Shuffle

DOWNLOAD Mathematica Notebook

A riffle shuffle, in which the top half of the deck is placed in the left hand, and cards are then alternatively interleaved from the left and right hands. Using an in-shuffle, a deck originally arranged 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 2n cards once moves card k to the position originally occupied by the (2k)th card (mod 2n+1) (Conway and Guy 1996). Therefore, in-shuffling an even number n of cards n times when n+1 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 n=2, 4, ... 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 2n+1).

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.