OFFSET
0,3
COMMENTS
Records occur at indices 0, 1, 2, 3, 5, 7, 11, 22, 23, 46, 47, 94, ... (see A297026).
LINKS
Peter Kagey, Table of n, a(n) for n = 0..10000
EXAMPLE
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Kagey and Alec Jones, Dec 24 2017
STATUS
approved