Let $n$ ($n\ge 3$) be a natural number. Denote by $f(n)$ the least natural number by which $n$ is not divisible (e.g. $f(12)=5$). If $f(n)\ge 3$, we may have $f(f(n))$ in the same way. Similarly, if $f(f(n))\ge 3$, we may have $f(f(f(n)))$, and so on. If $\underbrace{f(f(\dots f}_{k\text{ times}}(n)\dots ))=2$, we call $k$ the “length” of $n$ (also we denote by $l_n$ the “length” of $n$). For arbitrary natural number $n$ ($n\ge 3$), find $l_n$ with proof.
Problem
Source: China Mathematical Olympiad 1988 problem6
Tags: number theory, relatively prime, number theory unsolved