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-3 of 3 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).

A354113 The smallest number that contains all the digits of n in order but does not equal n.

Original entry on oeis.org

10, 10, 12, 13, 14, 15, 16, 17, 18, 19, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 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

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.

Examples

			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.
		

Crossrefs

Programs

  • 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

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).

A360443 Smallest integer m > n such that the multiset of nonzero decimal digits of m is exactly the same as the multiset of nonzero decimal digits of n.

Original entry on oeis.org

10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 101, 21, 31, 41, 51, 61, 71, 81, 91, 200, 102, 202, 32, 42, 52, 62, 72, 82, 92, 300, 103, 203, 303, 43, 53, 63, 73, 83, 93, 400, 104, 204, 304, 404, 54, 64, 74, 84, 94, 500, 105, 205, 305, 405, 505, 65, 75, 85, 95, 600
Offset: 1

Views

Author

Marc LeBrun and M. F. Hasler, Feb 22 2023

Keywords

Comments

Equivalently: a(n) is the number whose decimal digits are the next larger permutation of those of n, allowing any number of leading zeros.

Crossrefs

Cf. A057168 (analog for base 2), A354049 (digits of a(n) contain those of n as sub-multiset).
Cf. A009994 (numbers with digits in nondecreasing order: don't appear in this sequence).

Programs

  • PARI
    A360443(n)={forperm(concat(0,digits(n)),p,n||return(fromdigits(Vec(p))); n=0)} \\ M. F. Hasler, Feb 23 2023; similar idea also suggested by Ruud H.G. van Tol.
    
  • Python
    # From Arthur O'Dwyer, edited by M. F. Hasler, Feb 22 2023
    def A360443(n):
        s = '0' + str(n)
        i = next(i for i in range(len(s) - 1, 0, -1) if s[i-1] < s[i])
        tail = s[i-1:]
        j = min((ch, j) for j, ch in enumerate(tail) if s[i-1] < ch)[1]
        s = s[:i-1] + tail[j] + ''.join(sorted(tail[:j] + tail[j+1:]))
        return int(s)
    for n in range(1, 100): print(n, A360443(n))
Showing 1-3 of 3 results.