Re: [R] Curiously short cycles in iterated permutations with the same seed

2017-12-08 Thread William Dunlap via R-help
Landau's function gives the maximum cycle length of a permutation. See.,e.g., http://mathworld.wolfram.com/LandausFunction.html. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Dec 7, 2017 at 9:34 PM, Eric Berger wrote: > Hi Boris, > Do a search on "the order of elements of the symmetric g

Re: [R] Curiously short cycles in iterated permutations with the same seed

2017-12-07 Thread Eric Berger
Hi Boris, Do a search on "the order of elements of the symmetric group". (This search will also turn up homework questions and solutions.) You will understand why you are seeing this once you understand how a permutation is decomposed into cycles and how the order relates to a partition of n (n=10

[R] Curiously short cycles in iterated permutations with the same seed

2017-12-07 Thread Boris Steipe
I have noticed that when I iterate permutations of short vectors with the same seed, the cycle lengths are much shorter than I would expect by chance. For example: X <- 1:10 Xorig <- X start <- 112358 N <- 10 for (i in 1:N) { seed <- start + i for (j in 1:1000) { # Maximum cycle length to c