Finding Powers Of 2 With A Permutation

Time: :

21,22,23, ..., 2k where k is the order of 2 mod n =

The algorithm used here consists of the following two functions:
1. Given an odd integer n list all even integers smaller than n, followed by all odd integers smaller than n.
2. a. Look up the value at initial index.
    b. Make that value the initial index.
    c. Repeat a and b until the value equals 1.