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.

A354049 The smallest number that includes all the digits of n but does not equal n.

Original entry on oeis.org

10, 10, 12, 13, 14, 15, 16, 17, 18, 19, 100, 101, 21, 31, 41, 51, 61, 71, 81, 91, 102, 12, 122, 32, 42, 52, 62, 72, 82, 92, 103, 13, 23, 133, 43, 53, 63, 73, 83, 93, 104, 14, 24, 34, 144, 54, 64, 74, 84, 94, 105, 15, 25, 35, 45, 155, 65, 75, 85, 95, 106, 16, 26, 36, 46, 56, 166, 76, 86, 96, 107
Offset: 0

Views

Author

Keywords

Comments

The terms cannot start with a leading zero so any number including a zero must have at least one digit greater than zero as its first digit. See the examples below.

Examples

			a(9) = 19 as there is no smaller number that includes the digit 9 but does not equal 9.
a(10) = 100 as there is no smaller number that includes the digits 1 and 0 but does not equal 10. Note that '01' = 1 is not allowed.
a(20) = 102 as there is no smaller number that includes the digits 2 and 0 but does not equal 20. Note that '02' = 2 is not allowed.
a(22) = 122 as there is no smaller number that includes two 2 digits but does not equal 22.
a(200) = 1002 as there is no smaller number that includes two 0 digits and the digit 2 but does not equal 200.
		

Crossrefs

Programs

  • PARI
    vd(n) = my(d=if (n, digits(n), [0])); vector(10, k, #select(x->(x==k-1), d));
    isok(k, n, d) = if (k!=n, my(dd=vd(k)); for (i=1, #d, if (dd[i] < d[i], return(0))); return(1));
    a(n) = my(k=0, d=vd(n)); while(!isok(k, n, d), k++); k; \\ Michel Marcus, May 17 2022
    
  • Python
    def ok(k, n):
        if k == n: return False
        sk, sn = str(k), str(n)
        return all(sk.count(d) >= sn.count(d) for d in set(sn))
    def a(n):
        k = 0
        while not ok(k, n): k += 1
        return k
    print([a(n) for n in range(71)]) # Michael S. Branicky, May 23 2022