login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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