cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A230107 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.

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