login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = smallest positive number having no digits in common with n and greater than any earlier term.
2

%I #18 Aug 02 2015 17:15:34

%S 2,3,4,5,6,7,8,9,10,22,23,30,40,50,60,70,80,90,200,311,330,331,400,

%T 500,600,700,800,900,1000,1111,2000,4000,4001,5000,6000,7000,8000,

%U 9000,10000,11111,20000,30000,50000,50001,60000,70000,80000,90000,100000

%N a(n) = smallest positive number having no digits in common with n and greater than any earlier term.

%C 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

%C What is the last term? - _Robert G. Wilson v_, May 27 2009

%C The last index is indeed n = 123456788 and the last a(n) = 9(10^12362882) + 999. - _Robert G. Wilson v_, Jun 07 2010

%H Dmitry Kamenetsky, <a href="/A160015/b160015.txt">Table of n, a(n) for n = 1..10000</a>

%H Dmitry Kamenetsky, <a href="/A160015/a160015.java">Java program</a>

%e a(10)=22 because 22 is the smallest number > a(9) that doesn't contain 0 or 1.

%t 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 *)

%Y Cf. A096779.

%K nonn,base,fini

%O 1,1

%A _Rodolfo Kurchan_, Apr 29 2009

%E a(43)-a(90) from _Dmitry Kamenetsky_, May 03 2009

%E Incorrect b-file and Mathematica program deleted by _N. J. A. Sloane_, Jun 13 2009