OFFSET
1,3
MAPLE
a:= proc(n) option remember;
`if`(issqr(n), 0, 1+a(numtheory[phi](n)))
end:
seq(a(n), n=1..105); # Alois P. Heinz, Jun 12 2023
MATHEMATICA
a[n_] := -1 + Length @ NestWhileList[EulerPhi, n, ! IntegerQ[Sqrt[#]] &]; Array[a, 100] (* Amiram Eldar, Jun 11 2023 *)
PROG
(Python)
from sympy import totient
from sympy.ntheory.primetest import is_square
def a(n):
x = n
c = 0
while not is_square(x):
x = totient(x)
c += 1
return c
(PARI) a(n) = my(nb=0); while(!issquare(n), n=eulerphi(n); nb++); nb; \\ Michel Marcus, Jun 15 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Darío Clavijo, Jun 11 2023
STATUS
approved