Related: Iterated phi(n) function.
Your challenge is to compute the iterated phi function:
f(n) = number of iterations of φ for n to reach 1.
Where φ
is Euler's totient function.
Related OEIS.
Here's the graph of it:
Rules:
Your goal is to output f(n)
from n=2
to n=100
.
This is code-golf, so shortest code wins.
Here's the values you can check against:
1, 2, 2, 3, 2, 3, 3, 3, 3, 4, 3, 4, 3, 4, 4, 5, 3, 4, 4, 4, 4, 5, 4, 5, 4, 4, 4, 5, 4, 5, 5, 5, 5, 5, 4, 5, 4, 5, 5, 6, 4, 5, 5, 5, 5, 6, 5, 5, 5, 6, 5, 6, 4, 6, 5, 5, 5, 6, 5, 6, 5, 5, 6, 6, 5, 6, 6, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 5, 6, 7, 5, 7, 5, 6, 6, 7, 5, 6, 6, 6, 6, 6, 6, 7, 5, 6, 6
x
such thatphi(x)
is a particular fixed number. \$\endgroup\$ – user202729 Dec 4 '17 at 16:31f(n)
, rather than run it on a range of fixed numbers. This also makes a difference between languages with ability to apply functions on ranges with less bytes (partly chameleon challenge?) \$\endgroup\$ – Uriel Dec 4 '17 at 16:35