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.

A382371 Remove all occurrences of a digit from n such that the resulting number, formed by the remaining digits in their original order, is as large as possible. If no digits remain, a(n)=0.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 2, 2, 0, 3, 4, 5, 6, 7, 8, 9, 3, 3, 3, 0, 4, 5, 6, 7, 8, 9, 4, 4, 4, 4, 0, 5, 6, 7, 8, 9, 5, 5, 5, 5, 5, 0, 6, 7, 8, 9, 6, 6, 6, 6, 6, 6, 0, 7, 8, 9, 7, 7, 7, 7, 7, 7, 7, 0, 8, 9, 8, 8, 8, 8, 8, 8, 8, 8
Offset: 1

Views

Author

Rémy Sigrist, Mar 23 2025

Keywords

Comments

A variant of A382102.

Examples

			For n = 95, we remove (all copies of) the digit 5 and we get a(n) = 9.
For n = 88, we remove all copies of the digit 8 and we get a(88) = 0.
For n = 1917, we remove all copies of the digit 7 and we get a(n) = 191.
		

Crossrefs

Programs

  • Mathematica
    A382371[n_] := Max[Table[FromDigits[DeleteCases[#, d]], {d, DeleteDuplicates[#]}] & [IntegerDigits[n]]];
    Array[A382371, 100] (* Paolo Xausa, Mar 23 2025 *)
  • PARI
    a(n, base = 10) = { my (d = digits(n, base), s = Set(d)); vecmax(apply(r -> fromdigits(select(t -> t!=r, d), base), s)) }
    
  • Python
    def f(s, r):
        return int(s) if (s:=s.replace(r, "")) != "" else 0
    def a(n):
        s = str(n)
        return max(f(s, d) for d in set(s))
    print([a(n) for n in range(1, 88)]) # Michael S. Branicky, Mar 23 2025

Formula

a(n) >= A382102(n).
a(n) = 0 iff n belongs to A010785.