46.10 PermutationsList

PermutationsList( mset )

NrPermutationsList( mset )

PermutationsList returns the set of permutations of the multiset mset.

NrPermutationsList returns the number of permutations of the multiset mset.

A permutation is represented by a list that contains exactly the same elements as mset, but possibly in different order. If mset is a proper set there are |mset| ! (see Factorial) such permutations. Otherwise if the first elements appears k_1 times, the second element appears k_2 times and so on, the number of permutations is |mset|! / (k_1! k_2! ..), which is sometimes called multinomial coefficient.

    gap> PermutationsList( [1,2,3] );
    [ [ 1, 2, 3 ], [ 1, 3, 2 ], [ 2, 1, 3 ], [ 2, 3, 1 ], [ 3, 1, 2 ],
      [ 3, 2, 1 ] ]
    gap> PermutationsList( [1,1,2,2] );
    [ [ 1, 1, 2, 2 ], [ 1, 2, 1, 2 ], [ 1, 2, 2, 1 ], [ 2, 1, 1, 2 ],
      [ 2, 1, 2, 1 ], [ 2, 2, 1, 1 ] ]
    gap> NrPermutationsList( [1,2,2,3,3,3,4,4,4,4] );
    12600 

The function Arrangements (see Arrangements) is the generalization of PermutationsList that allows you to specify the size of the permutations. Derangements (see Derangements) computes permutations that have no fixpoints.

Previous Up Top Next
Index

GAP 3.4.4
April 1997