%I #28 Oct 21 2013 00:46:30
%S 0,0,-1,0,52,-1,11,0,-1,51,50,-1,49,10,-1,0,48,-1,9,50,-1,49,0,-1,47,
%T 48,-1,0,8,-1,49,46,-1,47,48,-1,45,0,-1,7,46,-1,47,6,-1,45,44,-1,0,46,
%U -1,5,5,-1,45,44,-1,43,4,-1,4,0,-1,4,44,-1,43,3,-1,0
%N Define a sequence by b(1)=n, b(k+1)=b(k)+(sum of digits of b(k)); a(n) is the number of steps needed to reach a term in A004207, or a(n) = -1 if the sequence never joins A004207.
%C Looking at b(k) mod 9 shows that a(n) = -1 whenever n is a multiple of 3 (since then the b sequence is disjoint from A004207).
%C Conjecture: the b sequence, for any starting value n, will eventually merge with one of A000004 (the zero sequence), A004207, A016052 or A016096.
%H <a href="/index/Coi#Colombian">Index entries for Colombian or self numbers and related sequences</a>
%e For n=3, A016052 never meets A004207, so a(3) = -1.
%e For n=5, A007618 meets A004207 at the 53rd term, 620, so a(5) = 53.
%p read transforms; # to get digsum
%p M:=2000;
%p # f(s) returns the sequence k->k+digsum(k) starting at s
%p f:=proc(s) global M; option remember; local n,k,s1;
%p s1:=[s]; k:=s;
%p for n from 1 to M do k:=k+digsum(k);
%p s1:=[op(s1),k]; od: end;
%p # g(s) returns (x,p), where x = first number in common between
%p # f(1) and f(s), and p is the position where it occurred.
%p # If f(1), f(s) are disjoint for M terms, returns (-1,-1)
%p S1:=convert(f(1),set):
%p g:=proc(s) global f,S1; local t1,p,S2,S3;
%p S2:=convert(f(s),set);
%p S3:= S1 intersect S2;
%p t1:=min(S3);
%p if (t1 = infinity) then RETURN(-1,-1); else
%p member(t1,f(s),'p'); RETURN(t1,p-1); fi;
%p end;
%p [seq(g(n)[2],n=1..20)];
%o (Haskell)
%o import Data.Maybe (fromMaybe)
%o a230107 = fromMaybe (-1) . f (10^5) 1 1 1 where
%o f k i u j v | k <= 0 = Nothing
%o | u < v = f (k - 1) (i + 1) (a062028 u) j v
%o | u > v = f (k - 1) i u (j + 1) (a062028 v)
%o | otherwise = Just j
%Y Cf. A004207, A016052, A007618, A006507, A016096, A062028, A230299.
%K sign,base
%O 0,5
%A _N. J. A. Sloane_ and _Reinhard Zumkeller_, Oct 15 2013; corrected Oct 20 2013