Problem

Source: 25th Olympic Revenge

Tags: number theory



Let $\{a_n\}_{n=1}^{\infty}$ be a sequence of positive integers such that $a_1=1$. For each $n \geq 1$, $a_{n+1}$ is the smallest positive integer, distinct from $a_1,a_2,...,a_n$, such that $\gcd(a_{n+1}a_n+1,a_i)=1$ for each $i=1,2,...,n$. Prove that every positive integer appears in $\{a_n\}_{n=1}^{\infty}$.