OFFSET
0,1
COMMENTS
If n begins with 1, then a(n) is obtained by inserting a 0 after it; otherwise a(n) is obtained by placing a 1 before n.
LINKS
Jianing Song, Table of n, a(n) for n = 0..10000
FORMULA
If 10^k <= n < 2*10^k, a(n) = n + 9*10^k; if 2*10^k <= n < 10^(k+1), a(n) = n + 10^(k+1).
EXAMPLE
The smallest number not equal to 19 containing the digits 1 and 9 in that order is 109, so a(19) = 109.
The smallest number not equal to 22 containing two 2's is 122, so a(22) = 122.
PROG
(PARI) a(n) = if(n==0, 10, my(k=logint(n, 10)); if(n<2*10^k, n+9*10^k, n+10^(k+1)))
(Python)
def a(n):
if n == 0: return 10
s = str(n)
return int(s[0]+"0"+s[1:]) if s[0] == "1" else int("1"+s)
print([a(n) for n in range(54)]) # Michael S. Branicky, May 17 2022
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Jianing Song, May 17 2022
STATUS
approved