MathDB
Another grasshopper problem

Source: Mexico National Olympaid 2019 P5

November 12, 2019
number theoryalgebra

Problem Statement

Let a>ba > b be relatively prime positive integers. A grashopper stands at point 00 in a number line. Each minute, the grashopper jumps according to the following rules:
[*] If the current minute is a multiple of aa and not a multiple of bb, it jumps aa units forward. [*] If the current minute is a multiple of bb and not a multiple of aa, it jumps bb units backward. [*] If the current minute is both a multiple of bb and a multiple of aa, it jumps aāˆ’ba - b units forward. [*] If the current minute is neither a multiple of aa nor a multiple of bb, it doesn't move.
Find all positions on the number line that the grasshopper will eventually reach.