• + 0 comments

    Observe that adding a "Room 0" doesn't change the results.

    => The task is to find the smallest n such that 2^n*A=A, mod (2N+1)

    => Divide all by gcd(A, 2N+1), then it becomes Euler's Theorem.

    => One way to find a candidate n is to use Euler's totient function.

    No. of rooms visited before returning to start will be n, or a factor of n.