login
A160015
a(n) = smallest positive number having no digits in common with n and greater than any earlier term.
2
2, 3, 4, 5, 6, 7, 8, 9, 10, 22, 23, 30, 40, 50, 60, 70, 80, 90, 200, 311, 330, 331, 400, 500, 600, 700, 800, 900, 1000, 1111, 2000, 4000, 4001, 5000, 6000, 7000, 8000, 9000, 10000, 11111, 20000, 30000, 50000, 50001, 60000, 70000, 80000, 90000, 100000
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, 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
Cf. A096779.
Sequence in context: A099469 A358097 A039112 * A276392 A132271 A116069
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