OFFSET
1,2
COMMENTS
The 1-digit numbers appear in the sequence in the following order: 0,1,3,2,4,5,7,6,8,9.
After the first initial terms, the sequence oscillates about the line y=x.
The first differences are bounded by 30 and -30 for the initial terms, then by 20 and -20. After the first 122 terms the sequence is bounded most of the time by 10 and -10, with eventual jumps that seem to remain bounded by 30 and -30.
Inverse: 1, 3, 11, 7, 15, 21, 31, 27, 37, 41, 2, 4, 5, 6, 16, 22, 32, 28, 36, 42, 10, 12, 13, 8, 14, 20, ..., . - Robert G. Wilson v, Dec 29 2017
Also: a(0) = 0 (and 0 counts as a digit). For n > 0, if n is odd respectively even then a(n) is the smallest integer not already in the sequence that contains the smallest respectively largest digit of a(n - 1). - David A. Corneth, Dec 29 2017
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..11111
EXAMPLE
a(2)=10 since it is the smallest number not yet in the sequence that contains the smallest digit in a(1)=0; a(3)=1 since it is the smallest number not yet in the sequence that contains the largest digit in a(2)=10.
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, 70] (* Robert G. Wilson v, Dec 29 2017 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Enrique Navarrete, Dec 28 2017
EXTENSIONS
Corrected a(65) onward by Robert G. Wilson v, Dec 29 2017
Definition clarified by N. J. A. Sloane, Jan 19 2018 and again Feb 08 2018
STATUS
approved