OFFSET
1,1
COMMENTS
The auxiliary sequence begins with x(0) = n and continues by adding or subtracting the digit sum. When the digitsum(x(i-1)) is even, x(i) = x(i-1) - digitsum(x(i-1)), otherwise x(i) = x(i-1) + digitsum(x(i-1)).
LINKS
Anthony Sand, Table of n, a(n) for n = 1..1000
FORMULA
x(i) = x(i-1) + digitsum(x(i-1)) * -(1 - (digitsum(x(i-1)) mod 2) * 2).
EXAMPLE
digitsum(81) = 9, 9 is odd, so 81 + 9 = 90. 90 + 9 = 99. digitsum(99) = 18, 18 is even, so 99 - 18 = 81, so 81 is in the list.
90 + 9 = 99. 99 - 18 = 81. 81 + 9 = 90.
99 - 18 = 81. 81 + 9 = 90. 90 + 9 = 99.
171 + 9 = 180. 180 + 9 = 189. 189 - 18 = 171.
180 + 9 = 189. 189 - 18 = 171. 171 + 9 = 180.
Starting with n=81, we have 81+9(odd)=90, 90+9(odd)=99, 99-18(even)=81 for the auxiliary x(i) sequence; so 81 is in the main sequence; starting with n=90 or 99 will lead to the same cycle loop, so 90, 99 are also in this sequence.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Anthony Sand, Jun 02 2014
STATUS
approved