OFFSET
1,2
COMMENTS
The 1-digit numbers appear in the sequence in the following order: 0,2,1,3,4,6,7,5,8,9.
After the initial terms, the sequence oscillates about the line y=x.
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.
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..5000
EXAMPLE
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.
MATHEMATICA
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 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Enrique Navarrete, Dec 28 2017
EXTENSIONS
Definition clarified by N. J. A. Sloane, Feb 08 2018
STATUS
approved