%I #23 May 17 2018 17:53:35
%S 0,1,10,11,12,13,2,3,20,23,21,22,14,24,4,25,34,5,30,15,31,16,17,6,7,
%T 26,27,28,29,8,9,18,19,38,39,32,33,35,36,37,43,47,40,41,42,44,45,46,
%U 48,49,54,59,50,51,52,53,55,56,57,58,65,68,60,61,62,63,64,66
%N a(n) is the least positive integer not yet in the sequence which shares a digit with a(n-2); a(1)=0, a(2)=1.
%C Up to n=34 the first differences of the sequence are bounded by -29 and 25; the bounds are -10 and 10 thereafter.
%C From a(103)=100 onwards, the sequence has slope = 1 with minor jumps about every 100 terms.
%C It appears that this sequence has an inverse, namely 1, 2, 7, 8, 15, 18, 24, 25, 30, 31, 3, 4, 5, 6, 13, 20, 22, 23, 32, 33, 9, ..., . - _Robert G. Wilson v_, Apr 29 2018 [Edited by _Rémy Sigrist_, May 06 2018]
%H R. J. Cano, <a href="/A303657/a303657.txt">Sequencer program in PARI.</a>
%e a(7)=2 since it is the least positive integer not yet in the sequence which shares a digit with a(5)=12.
%t f[s_List] := Block[{k = 2, l = Union@ IntegerDigits@ s[[-2]]}, While[MemberQ[s, k] || Intersection[l, IntegerDigits@ k] == {}, k++]; Append[s, k]]; Nest[f, {0, 1}, 70] (* _Robert G. Wilson v_, Apr 29 2018 *)
%o (PARI) Digits(x,b)=if(!x,[0],digits(x,b));
%o firstTerms(n,{k=2},{b=10})={my(N=b*n);my(s=List(vector(N,u,u-1)),t,x,y);for(m=k+1,n,x=Set(Digits(s[m-k],b));for(i=m,N,y=Set(Digits(s[i],b));if(#setintersect(x,y),t=s[i];listpop(s,i);listinsert(s,t,m);break)));return(Vec(s)[1..n])}
%o a(n)=firstTerms(n)[n]; \\ _R. J. Cano_, May 05 2018
%o (PARI) See Cano link.
%Y Cf. A107353, A303605.
%K nonn,base
%O 1,3
%A _Enrique Navarrete_, Apr 27 2018