Problem

Source: 2021 Saudi Arabia Training Lists p32 https://artofproblemsolving.com/community/c2758131_2021_saudi_arabia_training_tests

Tags: number theory, algebra, Sequence, remainder



Let $N$ be a positive integer. Consider the sequence $a_1, a_2, ..., a_N$ of positive integers, none of which is a multiple of $2^{N+1}$. For $n \ge N +1$, the number $a_n$ is defined as follows: choose $k$ to be the number among $1, 2, ..., n - 1$ for which the remainder obtained when $a_k$ is divided by $2^n$ is the smallest, and define $a_n = 2a_k$ (if there are more than one such $k$, choose the largest such $k$). Prove that there exist $M$ for which $a_n = a_M$ holds for every $n \ge M$.