muEC::SG::GenPerm – generates an element of the symmetric group

The muEC::SG::GenPerm function generates one element of a symmetric group in lexicographic order, according to the parameter typeperm.

muEC::SG::GenPerm(n, First) returns the first permutation of math.

muEC::SG::GenPerm(n, Last) returns the last permutation of math.

muEC::SG::GenPerm(perm, Previous) gives the previous permutation according to the lexicographic order. It returns the null() value when perm is already the first permutation.

muEC::SG::GenPerm(perm, Next) gives the next permutation according to the lexicographic order. It returns the null() value when perm is already the last permutation.

→ Examples

Calls:

muEC::SG::GenPerm(n, typeperm)

muEC::SG::GenPerm(perm, typeperm)

Parameters:

n

any positive integer

perm

any list denoting a permutation

typeperm

First, Previous, Next, Last

Related Functions:

Example 1:

muEC::SG::GenPerm( [3, 1, 4, 2], Next );

math

muEC::SG::GenPerm(%, Previous);

math