This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

PermutationListQ

PermutationListQ[expr]
returns True if expr is a valid permutation list and False otherwise.
  • A valid permutation list is a rearrangement of the integers .
A valid permutation list:
Invalid permutation lists:
A valid permutation list:
In[1]:=
Click for copyable input
Out[1]=
Invalid permutation lists:
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
In[4]:=
Click for copyable input
Out[4]=
PermutationListQ works efficiently with large permutation lists:
The empty list is considered a permutation list of length and degree 0:
RandomSample[Range[n]] always gives a valid permutation list:
A possible, but less efficient, Mathematica implementation:
Validity of permutations in cyclic form is checked with PermutationCyclesQ. A permutation list can always be obtained as a permutation of the elements in canonical order using Permute:
Ordering always returns a permutation list, even if the elements of the expression are repeated:
There are 409113 integer numbers up to whose decimal digits form permutation lists. This is how the first 153 (the largest being 54321) are distributed:
New in 8