Previous Up Next

5.10.17  Order of a permutation: permuorder

permuorder takes as argument a permutation.
permuorder returns the order k of the permutation p given as argument, that is the smallest integer m such that pm is the identity.
Input:

permuorder([0,2,1])

Output

2

Input:

permuorder([3,2,1,4,0])

Output

6

Previous Up Next