Problem 5
Larry and Rob are two robots travelling in one car from Argovia to Zillis. Both robots have control over the steering and steer according to this algorithm: Larry makes a 90° left turn after every kilometer driving from the start; Rob makes a 90° right turn after every kilometer driving from the start, where and are relatively prime positive integers. If both turns occur simultaneously, the car keeps going without changing direction. Assume the ground is flat and the car can move in any direction. The car starts from Argovia facing towards Zillis. For which pairs is the car guaranteed to reach Zillis, regardless of how far it is from Argovia?
Step 6 of 6: Reach every distance
Detailed analysis
When the residues are equal, the car begins every section facing east and ends one kilometer farther east. Its first kilometer in each section is traveled straight east, so the car passes through every point of each segment from n−1 to n on the x-axis. Hence every positive distance d is reached exactly when ell and r are both 1 modulo 4 or both 3 modulo 4.