OFFSET
0,3
COMMENTS
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.
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.
A329198 gives the size of n's orbit, i.e., the length of the trajectory until the terminating cycle is covered.
LINKS
E. Angelini, The ghost iteration, SeqFan list, Nov 2019
E. Angelini, The Ghost Iteration, Personal blog "Cinquante signes", Nov 2019
FORMULA
a(n) = n + (-1)^d*d where d = A040115(n), 0 for n < 10.
EXAMPLE
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.
PROG
(PARI) apply( A329200(n)={n+(-1)^(n=fromdigits(abs((n=digits(n+!n))[^-1]-n[^1])))*n}, [1..199])
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Eric Angelini and M. F. Hasler, Nov 09 2019
STATUS
approved