Problem

Source: Cyprus 2022 Junior TST-3 Problem 4

Tags: combinatorics, invariant



The numbers $1, 2, 3, \ldots , 10$ are written on the blackboard. In each step, Andrew chooses two numbers $a, b$ which are written on the blackboard such that $a\geqslant 2b$, he erases them, and in their place writes the number $a-2b$. Find all numbers $n$, such that after a sequence of steps as above, at the end only the number $n$ will remain on the blackboard.