Problem

Source: IMOC 2021 N3

Tags: number theory, Sequences



Define the function $f:\mathbb N_{>1}\to\mathbb N_{>1}$ such that $f(x)$ is the greatest prime factor of $x$. A sequence of positive integers $\{a_n\}$ satisfies $a_1=M>1$ and $$a_{n+1}=\begin{cases}a_n-f(a_n)&\text{if }a_n\text{ is composite.}\\a_n+k&\text{otherwise.}\end{cases}$$Show that for any positive integers $M,k$, the sequence $\{a_n\}$ is bounded. (TAN768092100853)