OFFSET
1,2
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..65537
FORMULA
EXAMPLE
From Antti Karttunen, Sep 24 2018: (Start)
For n = 1, A034460(1) = 0 that is, we end to a terminal zero after a transient part of length 1, thus a(1) = 1.
For n = 2, A034460(2) = 1, and A034460(1) = 0, so we end to a terminal zero after a transient part of length 2, thus a(2) = 2.
For n = 30, A034460(30) = 42, A034460(42) = 54, A034460(54) = 30, thus a(30) = a(42) = a(54) = 0, as 30, 42 and 54 are all contained in their own terminal cycle, without a preceding transient part. (End)
For n = 1506, the iteration-list is {1506, 1518, 1938, 2382, 2394, 2406, [2418, 2958, 3522, 3534, 4146, 4158, 3906, 3774, 4434, 4446, 3954, 3966, 3978, 3582, 2418, ..., ad infinitum]}. After a transient of length 6 the iteration ends in a cycle of length 14, thus a(1506) = 6.
MATHEMATICA
a034460[0] = 0; (* avoids dividing by 0 when an iteration reaches 0 *)
a034460[n_] := Total[Select[Divisors[n], GCD[#, n/#]==1&]]-n/; n>0
transient[k_] := Module[{iter=NestWhileList[a034460, k, UnsameQ, All]}, Position[iter, Last[iter]][[1, 1]]-1]
a097033[n_] := Map[transient, Range[n]]
a097033[105] (* Hartmut F. W. Hoft, Jan 24 2024 *)
PROG
(PARI)
A097033(n) = { my(visited = Map()); for(j=1, oo, if(mapisdefined(visited, n), return(mapget(visited, n)-1), mapput(visited, n, j)); n = A034460(n); if(!n, return(j))); }; \\ Antti Karttunen, Sep 23 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Aug 30 2004
EXTENSIONS
Definition corrected (to agree with the given terms) by Antti Karttunen, Sep 23 2018, based on observations by Hartmut F. W. Hoft
STATUS
approved