login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) is the smallest nonnegative integer of the same parity as n, not yet in the sequence, that shares a digit with a(n-1); a(0)=0.
1

%I #23 Feb 05 2020 16:54:45

%S 0,101,10,1,12,11,14,13,16,15,18,17,70,7,72,21,2,23,20,25,22,27,24,29,

%T 26,61,6,63,30,3,32,31,34,33,36,35,38,37,74,41,4,43,40,45,42,47,44,49,

%U 46,65,50,5,52,51,54,53,56,55,58,57,76,67,60,69,62,121,28,81,8

%N a(n) is the smallest nonnegative integer of the same parity as n, not yet in the sequence, that shares a digit with a(n-1); a(0)=0.

%C Conjecture: This is a permutation of the nonnegative integers.

%C The one-digit integers appear in the following order: 0,1,7,2,6,3,4,5,8,9.

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

%e a(1)=101 since 101 is the smallest odd nonnegative integer not yet in the sequence that shares the digit 0 with a(0)=0;

%e a(2)=10 since 10 is the smallest even nonnegative integer not yet in the sequence that shares the digit 0 (and 1) with a(1)=101.

%p N:= 1000: # to stop before the first term > N

%p S0:= [seq(i,i=2..N,2)]: S1:= [seq(i,i=1..N,2)]:

%p D0:= map(t -> convert(convert(t,base,10),set), S0):

%p D1:= map(t -> convert(convert(t,base,10),set), S1):

%p A[0]:= 0: Da:= {0}: found:= true:

%p for n from 1 while found do

%p found:= false;

%p if n::even then

%p for j from 1 to nops(D0) do

%p if Da intersect D0[j] <> {} then

%p found:= true;

%p A[n]:= S0[j];

%p Da:= D0[j];

%p S0:= subsop(j=NULL, S0);

%p D0:= subsop(j=NULL, D0);

%p break

%p fi

%p od

%p else

%p for j from 1 to nops(D1) do

%p if Da intersect D1[j] <> {} then

%p found:= true;

%p A[n]:= S1[j];

%p Da:= D1[j];

%p S1:= subsop(j=NULL, S1);

%p D1:= subsop(j=NULL, D1);

%p break

%p fi

%p od

%p fi

%p od:

%p seq(A[i],i=0..n-2); # _Robert Israel_, Feb 05 2020

%Y Cf. A107353, A297352, A297353.

%K nonn,base

%O 0,2

%A _Enrique Navarrete_, Aug 31 2018