login
A290223
Algorithm: s(k) = n. s(k+1) = s(k) - digitsum(s(k))^2 if s(k) >= 0 and s(k+1) = s(k)+digitsum(abs(s(k)))^2 if s(k) < 0. Below gives the end behavior for each number n.
3
0, 2, 3, 6, 6, 6, 3, 11, 9, 9, 3, 3, 6, 6, 6, 3, 11, 9, 0, 3, 3, 6, 2, 6, 3, 11, 9, 9, 11, 3, 6, 3, 6, 3, 11, 9, 9, 11, 3, 6, 3, 6, 3, 6, 9, 9, 11, 3, 6, 3, 6, 3, 6, 9, 9, 11, 3, 6, 6, 6, 3, 2, 9, 9, 11, 3, 6, 6, 6, 3, 3, 9, 9, 11, 3, 6, 2, 6, 3, 3, 0, 9, 11, 3, 6, 6, 6, 3, 6, 9, 9, 11, 3, 6, 6, 6, 3, 6, 9, 9, 3, 3, 6, 3, 6, 3, 3, 9, 9
OFFSET
1,2
COMMENTS
0 means the sequence s(k) becomes the 0 sequence.
2 means the sequence s(k) becomes 2, -2, 2, -2, ...
3 means the sequence s(k) becomes 3, -6, 30, 21, 12, 3, ...
6 means the sequence s(k) becomes 6, -30, -21, -12, -3, 6, ...
9 means the sequence s(k) oscillates between two numbers, each of which have a digit sum of 9. For example, 18 -> -63 -> 18 -> -63 -> ... so a(18) = 9.
11 means the sequence s(k) oscillates between two numbers, each of which have a digit sum of 11. For example, 65 -> -56 -> 65 -> ... so a(65) = 11.
a(n) = 2 for n = 2, 23, 62, 77, 119, 194, 287, 398. The next number n such that a(n) = 2 is over 10^5. This is believed to be finite.
a(n) = 11 for n = 8, 17, 26, 29, 35, 38, 47, 56, 65, 74, 83, 92, 149, 158, 167, 197. The next number n is over 10^5. This is believed to be finite.
The subsequences when a(n)=0, 3, 6, and 9 are believed to be infinite.
EXAMPLE
a(19) = 0 because 19 - (1+9)^2 = -81. Then -81 + (8+1)^2 = 0.
a(13) = 6 because 13 - (1+3)^2 = -3. Then -3 + (3)^2 = 6.
a(17) = 11 because 17 - (1+7)^2 = -47. Then -47 + (4+7)^2 = 74. Then 74 - (7+4)^2 = -47, and so on.
a(23) = 2 because 23 - (2+3)^2 = -2. Then -2 + (2)^2 = 2.
a(25) = 3 because 25 - (2+5)^2 = -24. Then -24 + (2+4)^2 = 12. Then 12 - (1+2)^2 = 3.
a(28) = 9 because 28 - (2+8)^2 = -72. Then -72 + (7+2)^2 = 9. Then 9-(9)^2 = -72, and so on.
PROG
(PARI)
a(n)=k=n; c=1; v=List(); listput(v, k); while(c, if(k>=0, k-=sumdigits(k)^2; c+=1; if(k==2||k==3||k==0||k==6||k==9, return(k)); if(vecsearch(Vec(v), k), return(sumdigits(abs(k)))); listput(v, k)); if(k<0, k+=sumdigits(-k)^2; c+=1; if(k==2||k==3||k==0||k==6||k==9, return(k)); if(vecsearch(Vec(v), k), return(sumdigits(abs(k)))); listput(v, k)); c+=1)
CROSSREFS
Sequence in context: A113399 A085273 A151850 * A274213 A350315 A078706
KEYWORD
nonn,base
AUTHOR
Derek Orr, Jul 24 2017
STATUS
approved