Let be a positive integer, and let be a positive integer coprime to . Let and, for all , recursively define
Find the greatest positive integer (as a function of and ) for which there exists an index such that is divisible by .
Let be a positive integer, and let be a positive integer coprime to . Let and, for all , recursively define
Find the greatest positive integer (as a function of and ) for which there exists an index such that is divisible by .
; note that this means .
**Solution 1. By induction, is coprime to .** Moreover, note that can increase for at most consecutive terms, so by induction
This implies . This gives .
We now prove that this upper bound indeed satisfies the requirement of the problem. Note that satisfying (1) also means that the sequence must eventually be periodic after some term. Let denote the multiplicative inverse of modulo ; then must include , which is equivalent to including . Let be the first term congruent to ; then or (otherwise , a contradiction.) In either case, by (1), we have , and hence
and none of the numbers in the set on the right is divisible by , so the sequence must reach the value within terms after .
**Solution 2. As in Solution 1, is coprime to and .** Let
and consider
Then and .
Let us prove that the above recursion is invertible. Suppose that for some pair :
- If , then necessarily , so and ;
- If , then necessarily , so and .
This shows that is a permutation of , with inverse
Now, since is a permutation of , it must be periodic, so there are infinitely many terms equal to 1. Take sufficiently large so that ; then we have