login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Starting with 0, select the next number having in decimal notation at least one common digit.
3

%I #17 Sep 21 2016 08:32:48

%S 0,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,32,33,34,

%T 35,36,37,38,39,43,44,45,46,47,48,49,54,55,56,57,58,59,65,66,67,68,69,

%U 76,77,78,79,87,88,89,90,91,92,93,94,95,96,97,98,99,109,110,111,112

%N Starting with 0, select the next number having in decimal notation at least one common digit.

%C a(n+1) = a(n)+1 unless a(n) is of the form d*10^k - 1, 1<=d<=8. - _Robert Israel_, Sep 21 2016

%H Harry J. Smith, <a href="/A063662/b063662.txt">Table of n, a(n) for n=0,...,1000</a>

%p A[0]:= 0: S:= {0}:

%p for n from 1 to 1000 do

%p for x from A[n-1]+1 do

%p Sx:= convert(convert(x,base,10),set);

%p if Sx intersect S <> {} then break fi;

%p od;

%p A[n]:= x;

%p S:= Sx;

%p od:

%p seq(A[i],i=0..1000); # _Robert Israel_, Sep 21 2016

%t NestList[Block[{k = # + 1}, While[! IntersectingQ[IntegerDigits@ k, IntegerDigits@ #], k++]; k] &, 0, 66] (* _Michael De Vlieger_, Sep 20 2016 *)

%o (PARI) XhasD(x,d)= { local(f); while (x>9, f=x-10*(x\10); if (f==d, return(1)); x\=10); return(x==d) } { a=0; for (n=0, 1000, if (n, for (m=a + 1, 10*a + 10, b=0; for (d=0, 9, if (XhasD(a, d) && XhasD(m, d), a=m; b=true; break)); if (b, break) ) ); write("b063662.txt", n, " ", a) ) } \\ _Harry J. Smith_, Aug 27 2009

%o (Haskell)

%o a063662_list = iterate a063660 0 -- _Reinhard Zumkeller_, Jan 15 2013

%Y A063662(0) = 0 and A063662(n + 1) = A063660(A063662(n))

%K easy,nonn,base

%O 0,2

%A _Reinhard Zumkeller_, Jul 25 2001