2019 USAJMO Problems/Problem 6

Two rational numbers \$\(\tfrac{m}{n}\)\$ (Error compiling LaTeX. ! LaTeX Error: Bad math environment delimiter.) and \$\(\tfrac{n}{m}\)\$ (Error compiling LaTeX. ! LaTeX Error: Bad math environment delimiter.) are written on a blackboard, where \$\(m\)\$ (Error compiling LaTeX. ! LaTeX Error: Bad math environment delimiter.) and \$\(n\)\$ (Error compiling LaTeX. ! LaTeX Error: Bad math environment delimiter.) are relatively prime positive integers. At any point, Evan may pick two of the numbers \$\(x\)\$ (Error compiling LaTeX. ! LaTeX Error: Bad math environment delimiter.) and \$\(y\)\$ (Error compiling LaTeX. ! LaTeX Error: Bad math environment delimiter.) written on the board and write either their arithmetic mean \$\(\tfrac{x+y}{2}\)\$ (Error compiling LaTeX. ! LaTeX Error: Bad math environment delimiter.) or their harmonic mean \$\(\tfrac{2xy}{x+y}\)\$ (Error compiling LaTeX. ! LaTeX Error: Bad math environment delimiter.) on the board as well. Find all pairs \$\((m,n)\)\$ (Error compiling LaTeX. ! LaTeX Error: Bad math environment delimiter.) such that Evan can write $1$ on the board in finitely many steps.

Proposed by Yannick Yao