Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #22 Feb 08 2018 17:16:01
%S 0,10,20,2,12,21,1,11,13,3,23,30,40,4,14,24,22,25,26,6,16,36,31,32,27,
%T 7,17,37,33,34,35,5,15,45,41,42,28,8,18,38,39,9,19,29,52,50,60,46,43,
%U 44,47,57,51,53,63,56,54,55,58,48,49,59,65,61
%N a(n) is the smallest positive number not yet in the sequence that if n is odd, contains the smallest digit in a(n-1), and if n is even, contains the largest digit in a(n-1); a(1)=0.
%C The 1-digit numbers appear in the sequence in the following order: 0,2,1,3,4,6,7,5,8,9.
%C After the initial terms, the sequence oscillates about the line y=x.
%C The first differences are bounded by 30 and -36 for the initial terms, then by 20 and -20. After the first 121 terms the sequence is bounded most of the time by 10 and -10, with eventual jumps that seem to remain bounded by 36 and -36.
%H Robert G. Wilson v, <a href="/A297353/b297353.txt">Table of n, a(n) for n = 1..5000</a>
%e a(2)=10 since it is the smallest number not yet in the sequence that contains the largest digit in a(1)=0; a(3)=20 since it is the smallest number not yet in the sequence that contains the smallest digit in a(2)=10; a(4)=2 since it is the smallest number not yet in the sequence that contains the largest digit in a(3)=20.
%t a[n_] := a[n] = Block[{k = 1, s = Union[ IntegerDigits[ a[n -1]]][[If[ OddQ@ n, 1, -1]]], t = Array[a, n - 1]}, While[ MemberQ[t, k] || ! MemberQ[ IntegerDigits@ k, s], k++]; k]; a[1] = 0; Array[a, 72] (* _Robert G. Wilson v_, Dec 30 2017 *)
%Y Cf. A297352.
%K nonn,base
%O 1,2
%A _Enrique Navarrete_, Dec 28 2017
%E Definition clarified by _N. J. A. Sloane_, Feb 08 2018