Permutations

Permutations[list]

generates a list of all possible permutations of the elements in list.

Permutations[list,n]

gives all permutations containing at most n elements.

Permutations[list,{n}]

gives all permutations containing exactly n elements.

Details

  • There are n! permutations of a list of n distinct elements.
  • Repeated elements are treated as identical.  »
  • The object list need not have head List.
  • Permutations[list] is effectively equivalent to Permutations[list,{Length[list]}].
  • Permutations[list,{nmin,nmax}] gives permutations of between nmin and nmax elements.

Examples

open allclose all

Basic Examples  (2)

Length-3 permutations of {a,b,c}:

In[1]:=
Click for copyable input
Out[1]=

Length-3 permutations of {a,b,c,d}:

In[1]:=
Click for copyable input
Out[1]=

Scope  (4)

Generalizations & Extensions  (1)

Properties & Relations  (3)

See Also

Sort  Signature  RandomSample  Tuples  Reverse  RotateLeft  Factorial  Subfactorial

Tutorials

Introduced in 1988
(1.0)
| Updated in 2007
(6.0)