A230299 Define a sequence b_s by b_s(1)=s, b_s(k+1)=b_s(k)+(sum of digits of b_s(k)); a(n) is the number of steps needed for b_n to reach a term in one of b_0, b_1, b_3 or b_9, or a(n) = -1 if b_n never joins one of these four sequences.
0, 0, 0, 0, 0, 52, 0, 11, 0, 0, 51, 50, 0, 49, 10, 0, 0, 48, 0, 9, 50, 0, 49, 0, 0, 47, 48, 0, 0, 8, 0, 49, 46, 0, 47, 48, 0, 45, 0, 0, 7, 46, 7, 47, 6, 0, 45, 44, 6, 0, 46, 0, 5, 5, 0, 45, 44, 0, 43, 4, 5, 4, 0, 0, 4, 44, 4, 43, 3, 0, 0, 42, 0, 3, 3, 4, 43, 0
Offset: 0
Links
Programs
-
Maple
read transforms; # to get digsum M:=2000; # f(s) returns the sequence k->k+digsum(k) starting at s f:=proc(s) global M; option remember; local n,k,s1; s1:=[s]; k:=s; for n from 1 to M do k:=k+digsum(k); s1:=[op(s1),k]; od: end; # g(s) returns (x,p), where x = first number in common between # f(s) and one of f(1), f(3), f(9) and p is the position where it occurred. # If f(s) and all of f(1), f(3), f(9) are disjoint for M terms, returns (-1,-1) S1:=convert(f(1),set): S3:=convert(f(3),set): S9:=convert(f(9),set): g:=proc(s) global f,S1,S3,S9; local t1,p,T0,T1,T2; T0:=f(s): T1:=convert(T0,set); if ((s mod 9) = 3) or ((s mod 9) = 6) then T2:= T1 intersect S3; t1:=min(T2); if (t1 = infinity) then RETURN(-1,-1); else member(t1,T0,'p'); RETURN(t1,p-1); fi; elif ((s mod 9) = 0) then T2:= T1 intersect S9; t1:=min(T2); if (t1 = infinity) then RETURN(-1,-1); else member(t1,T0,'p'); RETURN(t1,p-1); fi; else T2:= T1 intersect S1; t1:=min(T2); if (t1 = infinity) then RETURN(-1,-1); else member(t1,T0,'p'); RETURN(t1,p-1); fi; fi; end; [seq(g(n)[2],n=1..45)];
Extensions
Terms a(46) and beyond from Lars Blomberg, Jan 10 2018
Comments