Dan Drake <drake at lemongecko.org> wrote: > On Tue, 1 May 2001, Phil Mendelsohn wrote: > > > If you accidentally apply it twice, just apply it 26! - 2 more times > > > and that will fix the problem. :) > > > > I haven't looked at it; is it a permutation without any cycles? Are there > > no keys that remain fixed? This could be a slightly more interesting > > combinatorial problem than it appears... > > No, it's pretty trivial. The order of the group is 26!, and when you > raise an element to the order of the group, you get the identity. It's > quite possible that there's a smaller number that will get you back where > you started, but 26! will do it. There is certainly a much smaller number than 26!. The order of an element in the symmetric group is the LCM of its cycle lengths. For QWERTY->DVORAK I get the cycle decomposition of (Q ' - [ / Z ; S O R P L N B X) (W ,) (E . V K T Y F U G I C J H D) (A) (M) Cycle lengths of 15, 2, 14, 1, 1. So the order of that permutation is 210. Whew! You only have to apply the keymap 210 times to get back where you started, not 33! = 8683317618811886495518194401280000000 times. And you thought math would never help you out in real life. -- Al