Problem 7.6. The distance between cities A and B is an integer number of kilometers. Along the road between the cities, there is a signpost every kilometer: on one side is the distance to city A, and on the other side is the distance to city B. Slava walked from city A to city B. During his journey, Slava calculated the GCD of the numbers on each signpost. It turned out that among the calculated GCDs, only the numbers 1, 3, and 13 appeared. What is the distance between the cities?
Answer: 39.

Solution. Suppose we are standing next to a sign with numbers $x$ and $y$ written on it. If $\text{GCD}(x, y) = d$, then $(x + y) \vdots d$, i.e., the distance between the cities is divisible by all the calculated GCDs.

Now suppose the distance between the cities (let's call it $S$) is divisible by some natural number $d$. Then at a distance of $d$ kilometers from city A, the numbers on the sign are $d$ and $S - d$, and the GCD of these numbers is exactly $d$.

From all this, we conclude that 1, 3, and 13 are the complete list of divisors of the distance between the cities (excluding the distance itself). Therefore, the distance is 39 kilometers.