A363680 Number of iterations of phi(x) at n needed to reach a cube.
0, 1, 2, 2, 3, 2, 3, 0, 3, 3, 4, 3, 4, 3, 1, 1, 2, 3, 4, 1, 4, 4, 5, 1, 2, 4, 0, 4, 5, 1, 2, 2, 2, 2, 2, 4, 5, 4, 2, 2, 3, 4, 5, 2, 2, 5, 6, 2, 5, 2, 3, 2, 3, 4, 3, 2, 5, 5, 6, 2, 3, 2, 5, 0, 3, 2, 3, 3, 3, 2, 3, 2, 3, 5, 3, 5, 3, 2, 3, 3, 5, 3, 4, 2, 1, 5, 3
Offset: 1
Keywords
Programs
-
Mathematica
a[n_] := a[n] = If[IntegerQ[Surd[n, 3]], 0, a[EulerPhi[n]] + 1]; Array[a, 100] (* Amiram Eldar, Jun 14 2023 *)
-
PARI
a(n) = my(nb=0); while(!ispower(n, 3), n=eulerphi(n); nb++); nb; \\ Michel Marcus, Jun 15 2023
-
Python
from sympy import totient, integer_nthroot def a(n): x = n c = 0 while not integer_nthroot(x,3)[1]: x = totient(x) c += 1 return c