A354114 The smallest number that contains all the digits of n as a substring but does not equal n.
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
Offset: 0
Examples
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.
Links
- Jianing Song, Table of n, a(n) for n = 0..10000
Programs
-
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) print([a(n) for n in range(54)]) # Michael S. Branicky, May 17 2022
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).
Comments