A297025 Number of iterations of A220096 required to reach 0 starting from n.
0, 1, 2, 3, 3, 4, 4, 5, 4, 4, 5, 6, 5, 6, 6, 5, 5, 6, 5, 6, 6, 6, 7, 8, 6, 5, 7, 5, 7, 8, 6, 7, 6, 7, 7, 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 6, 9, 10, 7, 6, 6, 7, 8, 9, 6, 7, 8, 7, 9, 10, 7, 8, 8, 7, 7, 7, 8, 9, 8, 9, 7, 8, 7, 8, 8, 6, 8, 7, 8, 9, 8, 6, 9, 10, 8, 7
Offset: 0
Keywords
Examples
For n = 14, a(14) = 6 because six iterations are required to reach zero: A220096(14) = 7, A220096(7) = 6, A220096(6) = 3, A220096(3) = 2, A220096(2) = 1, and A220096(1) = 0.
Links
- Peter Kagey, Table of n, a(n) for n = 0..10000
Programs
-
Mathematica
g[n_Integer] := If[n == 1, 0, Block[{fi = FactorInteger@ n}, If[Plus @@ (Last@# & /@ FactorInteger@n) == 1, n -1, n/fi[[1, 1]] ]]]; f[n_] := Length@ NestWhileList[g, n, # > 0 &] -1; Array[f, 86, 0] (* Robert G. Wilson v, Dec 24 2017 *)
-
PARI
f(n) = if (n==1, 0, isprime(n), n-1, my(d=divisors(n)); d[#d-1]); a(n) = my(nb = 0); while (n, n = f(n); nb++); nb; \\ Michel Marcus, Dec 24 2017
Comments