Problem

Source: BdMO 2023 Higher Secondary National P3

Tags: function, number theory



For any positive integer $n$, define $f(n)$ to be the smallest positive integer that does not divide $n$. For example, $f(1)=2$, $f(6)=4$. Prove that for any positive integer $n$, either $f(f(n))$ or $f(f(f(n)))$ must be equal to $2$.