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.

This page as a plain text file.
%I A382371 #12 Mar 23 2025 23:22:39
%S A382371 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,
%T A382371 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,
%U A382371 9,7,7,7,7,7,7,7,0,8,9,8,8,8,8,8,8,8,8
%N 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.
%C A382371 A variant of A382102.
%H A382371 Rémy Sigrist, <a href="/A382371/b382371.txt">Table of n, a(n) for n = 1..10000</a>
%F A382371 a(n) >= A382102(n).
%F A382371 a(n) = 0 iff n belongs to A010785.
%e A382371 For n = 95, we remove (all copies of) the digit 5 and we get a(n) = 9.
%e A382371 For n = 88, we remove all copies of the digit 8 and we get a(88) = 0.
%e A382371 For n = 1917, we remove all copies of the digit 7 and we get a(n) = 191.
%t A382371 A382371[n_] := Max[Table[FromDigits[DeleteCases[#, d]], {d, DeleteDuplicates[#]}] & [IntegerDigits[n]]];
%t A382371 Array[A382371, 100] (* _Paolo Xausa_, Mar 23 2025 *)
%o A382371 (PARI) a(n, base = 10) = { my (d = digits(n, base), s = Set(d)); vecmax(apply(r -> fromdigits(select(t -> t!=r, d), base), s)) }
%o A382371 (Python)
%o A382371 def f(s, r):
%o A382371     return int(s) if (s:=s.replace(r, "")) != "" else 0
%o A382371 def a(n):
%o A382371     s = str(n)
%o A382371     return max(f(s, d) for d in set(s))
%o A382371 print([a(n) for n in range(1, 88)]) # _Michael S. Branicky_, Mar 23 2025
%Y A382371 Cf. A010785, A382102.
%K A382371 nonn,base,look
%O A382371 1,12
%A A382371 _Rémy Sigrist_, Mar 23 2025