OFFSET
1,1
COMMENTS
Sequence is finite: the last index is <= 123456788. a(123456789) cannot exist, since a number cannot contain all 0's. - Dmitry Kamenetsky, Jun 16 2009
What is the last term? - Robert G. Wilson v, May 27 2009
The last index is indeed n = 123456788 and the last a(n) = 9(10^12362882) + 999. - Robert G. Wilson v, Jun 07 2010
LINKS
Dmitry Kamenetsky, Table of n, a(n) for n = 1..10000
Dmitry Kamenetsky, Java program
EXAMPLE
a(10)=22 because 22 is the smallest number > a(9) that doesn't contain 0 or 1.
MATHEMATICA
f[Infinity, _] = Infinity; f[_, Range[0, 9] | Range[1, 9]] = Infinity; f[x_Integer, z_Integer] := f[IntegerDigits[1 + x], Union@IntegerDigits@z]; f[x_List, z_List] := Module[{n = Length@x, k = Flatten@ Position[x, Alternatives @@ z, 1, 1], low = Min@ Complement[ Range[0, 9], z]}, If[k == {}, FromDigits@x, k = First@k; f[10^(n - k) + FromDigits@ Flatten@ {Take[x, k], ConstantArray[low, n - k]} // IntegerDigits, z]]]; a[0] = 1; a[n_] := f[a[n - 1], n]; Array[a, 100] (* the function f(x, z) is from Bobby R. Treat (drbob(at)bigfoot.com) *) (* or *) k = 1; NestList[(k++; f[ #, k]) &, 2, 99] (* Robert G. Wilson v, Jun 07 2010 *)
CROSSREFS
KEYWORD
nonn,base,fini
AUTHOR
Rodolfo Kurchan, Apr 29 2009
EXTENSIONS
a(43)-a(90) from Dmitry Kamenetsky, May 03 2009
Incorrect b-file and Mathematica program deleted by N. J. A. Sloane, Jun 13 2009
STATUS
approved