Cycle lengths for Perfect shuffles of decks of any size
Haskell, 47 46 44 (in shuffle)
[[i|i&lt;-[1..],mod(2^i)n&lt;2]!!0|n&lt;-[3,5..1001]]

the basic realization is that this is the order of 2 in the multiplicative group of modulus n+1.