OFFSET
2,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 2..10000
FORMULA
a(n) = a(A064380(n)) + 1 for n > 2.
EXAMPLE
a(6) = 3 since there are 3 iterations from 6 to 1: iphi(6) = 3, iphi(3) = 2 and iphi(2) = 1.
MATHEMATICA
infCoprimeQ[n1_, n2_] := Module[{g = GCD[n1, n2]}, If[g == 1, True, AllTrue[FactorInteger[g][[;; , 1]], BitAnd @@ IntegerExponent[{n1, n2}, #] == 0 &]]];
iphi[n_] := Sum[Boole[infCoprimeQ[j, n]], {j, 1, n - 1}];
a[n_] := Length@ NestWhileList[iphi, n, # > 1 &] - 1;
Array[a, 100, 2]
PROG
(PARI) isinfcoprime(n1, n2) = {my(g = gcd(n1, n2), p, e1, e2); if(g == 1, return(1)); p = factor(g)[, 1]; for(i=1, #p, e1 = valuation(n1, p[i]); e2 = valuation(n2, p[i]); if(bitand(e1, e2) > 0, return(0))); 1; }
iphi(n) = sum(j = 1, n-1, isinfcoprime(j, n));
a(n) = if(n==2, 1, a(iphi(n)) + 1);
CROSSREFS
KEYWORD
nonn
AUTHOR
Amiram Eldar, Apr 05 2023
STATUS
approved