%I #22 Nov 15 2019 08:35:29
%S 1,1,1,1,1,1,1,1,1,1,2,1,2,5,2,4,2,3,2,3,2,3,1,2,5,2,4,2,3,2,3,2,3,1,
%T 2,5,2,4,2,3,2,3,2,3,1,2,5,2,4,2,3,2,3,2,3,1,2,5,2,4,2,3,2,3,2,3,1,2,
%U 5,2,4,2,3,2,3,2,3,1,2,5,2,4,2,3,2,3,2,3,1,2,5,2,4,2,3,2,3,2,3,1,8,6,3,6,3,6,4,6,5,6,7,1,2,6,2,5,2,4,2,4,3,8,3,3,8,3,4,3,4,3,7,6,2
%N Size of the orbit of n under "ghost iterations" A329200.
%C Or: Number of iterations of A329200 until a number is seen for the second time in the trajectory of n.
%C A329200 consists of adding to n the number whose digits are the differences of adjacent digits of n in case it is even, or subtracting it if it is odd.
%C The trajectory of most small numbers ends in a repdigit (A010785) which are fixed points of this map. Some larger numbers enter nontrivial cycles, cf. examples and A329196. In both cases, some number(s) will appear infinitely often in the trajectory. This sequence gives the number of iterations until a value is repeated for the first time in the trajectory of n. This is also the size of n's orbit, i.e. the total number of distinct values that will ever appear.
%C If n is part of the cycle, a(n) gives the length of the cycle; in particular a(n) = 1 for fixed points.
%C For 11 <= n <= 99 the pattern (1, 2, 5, 2, 4, 2, 3, 2, 3, 2, 3) of length 11 repeats, i.e., a(n) = a(n') if n = n' (mod 11). But the trajectory of congruent n with same a(n) does not always end in the corresponding repdigit, e.g., 11+2 and 22+2 both end in 22, 33+2 ends in 33, 44+2 ends in 44, 55+2 and 66+2 both end in 66, 77+2 and 88+2 in 77, etc.
%H Lars Blomberg, <a href="/A329198/b329198.txt">Table of n, a(n) for n = 0..9999</a>
%F a(n) = 1 <=> n is a fixed point of A329200 <=> n is a repdigit number (A010785).
%e The smallest starting value for which the trajectory does not end in a fixed point is n = 8059: Here it enters after 14 iterations a cycle of length 5, 11090 -> 10891 -> 12709 -> 11130 -> 11107 -> 11090 etc., so a(8059) = 14 + 5 = 19.
%e Many other values after this n (8079, 8260, 8262, ..., 9008, ...) enter the same loop at 11090, others (9060, 9062, 9064, 9066, ...) enter the same loop at 12709.
%e Starting value n = 37908 leads after two steps into the new cycle (44232, 44021, 43600, 44960, 45496, 44343) of length 6, so a(37908) = 8.
%e Starting value n = 68060 leads after 8 steps into a cycle of length 7, (75800, 78180, 79958, 77915, 78199, 79979, 82001), so a(68060) = 15.
%e a(70502) = 6 because this starting value leads after 3 steps into the loop (74780, 78098, 76207).
%e a(70515) = 20, entering the loop (111090, 110891, 112709, 111130, 111107) after 15 steps. See A329196 for more cycles and related information.
%o (PARI) A329198(n,M=oo,U=[n])={for(k=1,M,setsearch(U,n=A329200(n))&&return(k); U=setunion(U,[n]))}
%Y Cf. A329200, A329196 (cycles), A329197 (length of cycles).
%Y Cf. A329340 (analog for the variant A329201).
%K nonn
%O 0,11
%A _M. F. Hasler_, Nov 10 2019