We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Ichigo and Rooms
Ichigo and Rooms
Sort by
recency
|
6 Discussions
|
Please Login in order to post a comment
Another variation of the theme, at least I did it by myself ;-)
Python3
Working Python3 code
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.
Any hint on other patterns to be observed ? :
1. f(N,A) == f(N,-A)
2. When (2N+1) is prime, A is irrelevant.