Skip to content

Permutations

Permutations[list] lists the possible permutations for a given list.

Attributes[Permutations] := {Protected}

Simple examples

Find the permutations of {1, 2, 3}:

In[1]:= Permutations[Range[3]]
Out[1]= {{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}}
Permutations ignores duplicates:
In[2]:= Permutations[{1, 2, 2}]
Out[2]= {{1, 2, 2}, {2, 1, 2}, {2, 2, 1}}