|
|
A354114
|
|
The smallest number that contains all the digits of n as a substring but does not equal n.
|
|
2
|
|
|
10, 10, 12, 13, 14, 15, 16, 17, 18, 19, 100, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
COMMENTS
|
Suppose that n > 0 is a k-digit number. If 10^(k-1) <= a(n) <= (10^k-1)/9, then a(n) is obtained by placing a 0 after n; otherwise a(n) is obtained by placing a 1 before n.
|
|
LINKS
|
|
|
FORMULA
|
If 10^k <= n <= (10^(k+1)-1)/9, a(n) = 10*n; if (10^(k+1)-1)/9 <= n < 10^(k+1), a(n) = n + 10^(k+1).
|
|
EXAMPLE
|
The smallest number not equal to 111 containing the substring "111" in its decimal expansion is 1110, so a(111) = 1110.
The smallest number not equal to 112 containing the substring "112" in its decimal expansion is 1112, so a(112) = 1112.
|
|
PROG
|
(PARI) a(n) = if(n==0, 10, my(k=logint(n, 10)); if(n<=10^(k+1)\9, 10*n, n+10^(k+1)))
(Python)
def a(n):
if n == 0: return 10
s = str(n)
return n*10 if s <= "1"*len(s) else int("1"+s)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|