cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A354114 The smallest number that contains all the digits of n as a substring but does not equal n.

Original entry on oeis.org

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

Views

Author

Jianing Song, May 17 2022

Keywords

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.

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.
		

Crossrefs

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).
Showing 1-1 of 1 results.