Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

permorder

The order of a permutation


Description

Returns the order of a permutation P: the smallest strictly positive integer n for which P^n is the identity.

Usage

permorder(x, singly = TRUE)

Arguments

x

Permutation, coerced to cycle form

singly

Boolean, with default TRUE meaning to return the order of each element of the vector, and FALSE meaning to return the order of the vector itself (that is, the smallest strictly positive integer for which all(x^n==id)).

Details

Coerces its argument to cycle form.

The order of the identity permutation is 1.

Note

Uses mLCM() from the numbers package.

Author(s)

Robin K. S. Hankin

See Also

Examples

x <- rperm(5,20)
permorder(x)
permorder(x,FALSE)

stopifnot(all(is.id(x^permorder(x))))
stopifnot(is.id(x^permorder(x,FALSE)))

permutations

The Symmetric Group: Permutations of a Finite Set

v1.0-9
GPL-2
Authors
Robin K. S. Hankin [aut, cre] (<https://orcid.org/0000-0001-5982-0415>), Paul Egeler [ctb] (<https://orcid.org/0000-0001-6948-9498>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.