# perfect shuffle of 2n cards

permutation is given by f(i) = 2i if i<=n and 2(i-n)-1 if i>n

where i denotes the position of cards. eg pack of cards (1,2,3,4)-->(3,1,4,2)

Basically trying to find the multiplicative order of 2 mod(2n+1) got pretty far with for special cases such as 2n+1 being prime.

if 2n+1 = 2^k+1 then order = 2k

if 2n+1 = 2^k-1 then order = k

if 2n+1 = 2m+1 where m prime and m=3(mod4) then order = m

i thought the rest would have order = 2n by fermats little theoram but when 2n+1=103 this is not the case (it has order 51)

any help would be much appreciated

-