OFFSET
1,2
COMMENTS
Here "terminate" means reaching 0 or a cycle.
From M. F. Hasler, Feb 11 2009: (Start)
"Reaching a cycle" could be better defined: does it mean "reach a value that occured earlier" or "reach an element belonging to a cycle"?
I think the second is the case, but the value 0 is currently listed at n=14, wouldn't it correspond to x=15 = least element of a nontrivial cycle?
So would the offset be 2 ? or is there a missing term (since the first terms 1,2,3 seem well to correspond to x=1,2,3)? (End)
EXAMPLE
a(4) = 6 because 4 -> [{2,2}->{1,1}] ->[{11}->{5}] -> [{5}->{3}] -> [{3}->{2}] -> [{2}->{1}] -> [{1}->{0}].
MATHEMATICA
f[n_] := FromDigits@ Flatten[ IntegerDigits@# & /@ (PrimePi@# & /@ Flatten[ Table[ First@#, {Last@#}] & /@ FactorInteger@n])]; g[n_] := Length@ NestWhileList[f, n, UnsameQ, All] - 2; Array[g, 39]
CROSSREFS
KEYWORD
base,nonn,more
AUTHOR
Robert G. Wilson v, Feb 02 2009
EXTENSIONS
Edited by N. J. A. Sloane, Feb 10 2009
STATUS
approved