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 list between nmin and nmax elements. Permutations[list,{nmin,nmax,dn}] uses step dn.
- Permutations[list,All] is equivalent to Permutations[list,{0,Length[list]}].
Examples
open allclose allScope (4)
Properties & Relations (4)
The number of length-n permutations of a length-n list of distinct elements is n!:
The number of length-r permutations of a length-n list of distinct elements is FactorialPower[n,r]:
A permutation that leaves no element invariant is called a derangement:
The number of derangements of n distinct elements is Subfactorial[n]:
If the input list is in the order given by Sort, so are its length-r permutations:
Text
Wolfram Research (1988), Permutations, Wolfram Language function, https://reference.wolfram.com/language/ref/Permutations.html (updated 2007).
CMS
Wolfram Language. 1988. "Permutations." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/Permutations.html.
APA
Wolfram Language. (1988). Permutations. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Permutations.html