Function Repository Resource:

# ShuffleOrder

Determine how many shuffles restore the list of specified size to its original order

Contributed by: Wolfram Staff
 ResourceFunction["ShuffleOrder"][shuffle,n] gives the shuffle order for a size-n list.

## Details and Options

The shuffle order is the number of times a shuffle should be repeated to restore the original sequence of elements in the list.
The shuffle order is also known as the shuffle period.
In ResourceFunction["ShuffleOrder"][shuffle,n], shuffle can be one of the following:
 "type" string type, as defined in the resource function Shuffle ResourceFunction["Shuffle"][…] operator form of ResourceFunction["Shuffle"] fun a pure function that acts on a list

## Examples

### Basic Examples (2)

The shuffle order of a perfect out shuffle of a list of the specified size:

 In[1]:=
 Out[1]=

Same as:

 In[2]:=
 Out[2]=

### Properties and Relations (2)

ShuffleOrder is determined by the PermutationOrder of a shuffle:

 In[3]:=
 Out[3]=
 In[4]:=
 Out[4]=

Or, alternatively, by the least common multiple of the lengths of its cycles:

 In[5]:=
 Out[5]=
 In[6]:=
 Out[6]=
 In[7]:=
 Out[7]=

The shuffle order can also be determined, possibly less efficiently, using its definition:

 In[8]:=

For a milk shuffle:

 In[9]:=
 Out[9]=
 In[10]:=
 Out[10]=

### Neat Examples (1)

Restore a shuffled deck of cards to its original order:

 In[11]:=
 Out[11]=
 In[12]:=
 Out[12]=
 In[13]:=
 Out[13]=

## Version History

• 1.0.0 – 14 September 2020