Let be a positive integer, and let be a positive integer coprime to . Let and, for , define
Find the greatest positive integer for which there exists an index such that is divisible by . (Croatia)
Answer: is the exponent with .
Solution
By trivial induction, is coprime to . By induction and the fact that there can be at most consecutive increasing terms in the sequence, it also holds that if and that if or . This gives the upper bound on the exponent. This implies that the sequence is (eventually) periodic, and that both increasing and decreasing steps happen infinitely many times. Let be the multiplicative inverse of modulo . The sequence contains elements congruent to modulo . Let the first element such that . We have either or ; in both cases and therefore
In this set no element is divisible by , so therefore the sequence will visit the value in the next steps.
Want a route through all this instead of an archive? The track
puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.