%I #26 Jan 15 2023 18:38:42
%S 0,1,2,3,4,5,6,7,8,9,9,11,11,15,11,19,11,23,11,27,22,20,22,22,26,22,
%T 30,22,34,22,27,33,31,33,33,37,33,41,33,45,44,38,44,42,44,44,48,44,52,
%U 44,45,55,49,55,53,55,55,59,55,63,66,56,66,60,66,64,66,66,70,66,63,77,67,77,71,77
%N The ghost iteration (A): add or subtract the number formed by absolute differences of digits (A040115), according to parity (even or odd).
%C Sequence A040115 is most naturally extended to 0 (empty sum) for single-digit arguments; that's what we use here. This value is added to n if even, subtracted if odd.
%C Repdigit numbers are the fixed points. Other starting values end in nontrivial loops under iterations of this map, like 11090 -> 10891 -> 12709 -> 11130 -> 11107 -> 11090 etc. Table A329196 lists these cycles, A329197 their lengths.
%C A329198 gives the size of n's orbit, i.e., the length of the trajectory until the terminating cycle is covered.
%H E. Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2019-November/">The ghost iteration</a>, SeqFan list, Nov 2019
%H E. Angelini, <a href="http://cinquantesignes.blogspot.com/2019/11/the-ghost-iteration.html">The Ghost Iteration</a>, Personal blog "Cinquante signes", Nov 2019
%F a(n) = n + (-1)^d*d where d = A040115(n), 0 for n < 10.
%e For n = 101, the number formed by the absolute differences of digits is 11, since this is odd it is subtracted from n, so a(101) = 101-11 = 90.
%o (PARI) apply( A329200(n)={n+(-1)^(n=fromdigits(abs((n=digits(n+!n))[^-1]-n[^1])))*n}, [1..199])
%Y Cf. A040115, A329201 (variant B: add/subtract if odd/even).
%Y Cf. A329196 (cycles), A329197 (lengths), A329198 (size of orbit of n).
%K nonn,base,easy
%O 0,3
%A _Eric Angelini_ and _M. F. Hasler_, Nov 09 2019