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.

This page as a plain text file.
%I A354049 #17 May 23 2022 12:29:17
%S A354049 10,10,12,13,14,15,16,17,18,19,100,101,21,31,41,51,61,71,81,91,102,12,
%T A354049 122,32,42,52,62,72,82,92,103,13,23,133,43,53,63,73,83,93,104,14,24,
%U A354049 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
%N A354049 The smallest number that includes all the digits of n but does not equal n.
%C A354049 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.
%H A354049 Scott R. Shannon, <a href="/A354049/b354049.txt">Table of n, a(n) for n = 0..9999</a>
%H A354049 Scott R. Shannon, <a href="/A354049/a354049.png">Image of the first 100000 terms</a>. The green line is y = n.
%e A354049 a(9) = 19 as there is no smaller number that includes the digit 9 but does not equal 9.
%e A354049 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.
%e A354049 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.
%e A354049 a(22) = 122 as there is no smaller number that includes two 2 digits but does not equal 22.
%e A354049 a(200) = 1002 as there is no smaller number that includes two 0 digits and the digit 2 but does not equal 200.
%o A354049 (PARI) vd(n) = my(d=if (n, digits(n), [0])); vector(10, k, #select(x->(x==k-1), d));
%o A354049 isok(k, n, d) = if (k!=n, my(dd=vd(k)); for (i=1, #d, if (dd[i] < d[i], return(0))); return(1));
%o A354049 a(n) = my(k=0, d=vd(n)); while(!isok(k, n, d), k++); k; \\ _Michel Marcus_, May 17 2022
%o A354049 (Python)
%o A354049 def ok(k, n):
%o A354049     if k == n: return False
%o A354049     sk, sn = str(k), str(n)
%o A354049     return all(sk.count(d) >= sn.count(d) for d in set(sn))
%o A354049 def a(n):
%o A354049     k = 0
%o A354049     while not ok(k, n): k += 1
%o A354049     return k
%o A354049 print([a(n) for n in range(71)]) # _Michael S. Branicky_, May 23 2022
%Y A354049 Cf. A004185, A004185, A337227.
%K A354049 nonn,base,look
%O A354049 0,1
%A A354049 _Scott R. Shannon_ and _Zach J. Shannon_, May 16 2022