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”).

Greatest digit not used in n (or 10 if n is pandigital).
3

%I #10 Apr 13 2024 22:52:47

%S 9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,8,9,9,9,9,

%T 9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,

%U 9,8,9,9,9,9,9,9,9,9,9,8,9,9,9,9,9,9,9,9,9,7,8,8,8,8,8,8,8,8,7,8,9,9,9,9,9

%N Greatest digit not used in n (or 10 if n is pandigital).

%C a(A050278(1)) = a(1023456789) = 10, the first term with that value, as 1023456789 is the first base 10 pandigital number.

%H Alois P. Heinz, <a href="/A116667/b116667.txt">Table of n, a(n) for n = 0..10000</a>

%e a(89) = 7 because decimal digits 8 and 9 are both used in 89.

%o (Python)

%o def A116667(n):

%o s = set(str(n))

%o for i in range(9,-1,-1):

%o if str(i) not in s:

%o return i

%o return 10 # _Chai Wah Wu_, Apr 13 2024

%Y Cf. A067898 (least digit not used in n), A050278 (pandigital numbers).

%K base,easy,nonn

%O 0,1

%A _Rick L. Shepherd_, Feb 22 2006