Totient chain
= Totient chain
The sequence $n,\varphi(n),\varphi(\varphi(n)),\ldots,1$ obtained by iterating <Euler's totient function> on a <positive integer>. Since $1\le\varphi(n)<n$ for $n>1$, the sequence reaches 1. Counting both endpoints gives the length <recurrence relation> $L(1)=1$ and $L(n)=1+L(\varphi(n))$; increasing order of $n$ therefore suffices for <dynamic programming>.