A362024 The number of iterations of the infinitary totient function iphi (A064380) required to reach from n to 1.
1, 2, 3, 4, 3, 4, 4, 5, 5, 6, 5, 6, 5, 6, 7, 8, 7, 8, 7, 6, 6, 7, 6, 7, 8, 8, 9, 10, 7, 8, 8, 7, 7, 8, 9, 10, 7, 9, 8, 9, 9, 10, 9, 8, 11, 12, 8, 9, 9, 10, 10, 11, 7, 10, 9, 9, 11, 12, 8, 9, 9, 10, 9, 10, 8, 9, 11, 10, 9, 10, 8, 9, 9, 8, 10, 10, 10, 11, 11, 12
Offset: 2
Keywords
Examples
a(6) = 3 since there are 3 iterations from 6 to 1: iphi(6) = 3, iphi(3) = 2 and iphi(2) = 1.
Links
- Amiram Eldar, Table of n, a(n) for n = 2..10000
Programs
-
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]
-
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);
Formula
a(n) = a(A064380(n)) + 1 for n > 2.