login
Slowest increasing sequence where some digit of a(n) and some digit of a(n+1) add up to 9.
2

%I #8 Feb 24 2017 02:54:21

%S 0,9,10,18,19,20,27,28,31,36,37,42,45,46,50,54,55,64,65,73,76,82,87,

%T 91,98,100,108,109,110,118,119,120,127,128,129,130,136,137,138,139,

%U 140,145,146,148,149,150,154,155,158,159,160,163,164,165,168,169,170,172,173

%N Slowest increasing sequence where some digit of a(n) and some digit of a(n+1) add up to 9.

%C Starting with another "seed" than 0 would produce another sequence.

%H Robert Israel, <a href="/A107433/b107433.txt">Table of n, a(n) for n = 0..10000</a>

%e After 28 we must have an integer containing a "7" (2+"7"=9) or a "1" (8+"1"=9). The smallest integer satisfying this constraint is 31 (and not 37 or 41 or any other containing a "7" or a "1")

%p f:= proc(n) local S, k;

%p S:= map(t -> 9-t, convert(convert(n,base,10),set));

%p for k from n+1 do

%p if convert(convert(k,base,10),set) intersect S <> {} then return k fi

%p od

%p end proc:

%p a[0]:= 0:

%p for n from 1 to 100 do a[n]:= f(a[n-1]) od:

%p seq(a[n],n=0..100); # _Robert Israel_, Feb 24 2017

%K base,easy,nonn

%O 0,2

%A _Eric Angelini_, Jun 09 2005

%E Corrected and extended by _Zak Seidov_, Jun 10 2005