%I #28 May 20 2017 21:44:26
%S 1,1,1,1,2,2,2,1,2,2,1,2,1,1,1,1,1,1,2,1,2,2,4,1,1,1,2,1,4,4,2,1,4,4,
%T 2,4,2,2,6,4,2,4,6,4,2,2,6,4,6,2,1,2,6,2,6,2,1,1,6,2,6,6,6,1,2,6,6,6,
%U 6,6,6,2,6,6,6,6,6,6,6,2,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,2,6,6,6,6,6,6,6,6,6
%N Function f(x) = phi(x) + floor(x/2) is iterated, starting at x=n; a(n) is the length of terminal cycle (or 0 if no finite cycle exists).
%C While iteration of phi(x) always leads to a fixed point, f(x) = phi(x) + incr(x) may result in cycles or be divergent. What is the magnitude of the added incrementing function?
%C Some initial values are hard to analyze. The first is n=163, so perhaps a(163)=0 by definition.
%C Observation regarding the above comment: most n <= 1000 have 1 <= a(n) <= 12; the following have unresolved cycles at 10^3 iterations of f(x): {163, 182, 196, 243, 283, 331, 423, 487, 495, 503, 511, 523, 533, 551, 559, 571, 583, 591, 593, ...}. - _Michael De Vlieger_, May 16 2017
%H Michael De Vlieger, <a href="/A097026/b097026.txt">Table of n, a(n) for n = 1..162</a>
%H Michael De Vlieger, <a href="/A097026/a097026.txt">Table of n, a(n) for n = 1..1000</a> with 0 representing terms that have unresolved cycles at 10^3 iterations of f(x).
%F For n=2^j: a(2^j)=1, powers of 2 are fixed points.
%e n=70: iteration list = {70, 59, 87, 99, 109, 162, 135, 139, 207, 235, 301, 402, 333, 382, 381, 442, [413, 554, 553, 744, 612, 498], 413}, a(70)=6;
%t With[{nn = 10^3}, Table[Count[Values@ PositionIndex@ NestList[EulerPhi@ # + Floor[#/2] &, n, nn], s_ /; Length@ s > 1], {n, 105}]] (* _Michael De Vlieger_, May 16 2017 *)
%o (PARI) findpos(newn, v) = {forstep(k=#v, 1, -1, if (v[k] == newn, return(k)););}
%o a(n) = {ok = 0; v = [n]; while(!ok, newn = eulerphi(n) + n\2; ipos = findpos(newn, v); if (ipos, ok = 1; break); v = concat(v, newn); n = newn;); #v - ipos + 1;} \\ _Michel Marcus_, Jan 03 2017
%Y Cf. A000010, A097027, A097028, A097029.
%K nonn
%O 1,5
%A _Labos Elemer_, Aug 27 2004