Mary and Pat play the following number game. Mary picks an initial integer greater than . She then multiplies this number by and adds to the result. Pat will add to this new number and it will again be Mary's turn. Both players will continue to take alternating turns. Mary will always multiply the current number by and add to the result when it is her turn. Pat will always add to the current number when it is his turn. Pat wins if any of the numbers obtained by either player is divisible by . Mary wants to prevent Pat from winning the game. Determine, with proof, the smallest initial integer Mary could choose in order to achieve this.
Solution
Let be the initial integer Mary has picked. Because
the numbers produced (mod ) are
where indicates Mary's turn and indicates Pat's turn. We see that the values produced (mod ) form a cycle of length . Hence, Mary wins exactly when none of the numbers is divisible by , i.e., if does not have remainder , , or on division by . The smallest integer greater than that satisfies this condition is .
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.