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.

A340184 n with the rightmost occurrence of the smallest digit of n deleted.

Original entry on oeis.org

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

Views

Author

W. Edwin Clark, Jan 02 2021

Keywords

Comments

Suggested by Eric Angelini's posting to Math-Fun Mailing List, Dec 29 2020.

Examples

			For n = 32522529, the smallest digit is 2, and its rightmost occurrence is at the tens position, so a(n) = 3252259.
		

Crossrefs

Cf. A054054 (smallest digit of n).

Programs

  • Maple
    leastdigit:=proc(n)
      min(convert(n,base,10));
    end:
    locationdigit:=proc(n,d)
    local L,i;
    L:=convert(n,base,10);
    for i from 1 to nops(L) do
       if d = L[i] then return (nops(L)+1-i); fi;
    od:
    end:
    cutout:=proc(X,i)
    [seq(X[j],j=1..i-1),seq(X[j],j=i+1..nops(X))];
    end:
    ToNum:=proc(X)
      add(X[i]*10^(nops(X)-i),i=1..nops(X));
    end:
    a:=proc(n)
    local i,X;
    i:=locationdigit(n,leastdigit(n));
    X:=ListTools:-Reverse(convert(n,base,10));
    ToNum(cutout(X,i));
    end proc:
  • PARI
    a(n) = if (n<10, 0, my(d=digits(n), x=vecmin(d), s=""); forstep (k=#d, 1, -1, if (d[k] != x, s = concat(d[k], s), x=-1)); eval(s)); \\ Michel Marcus, Jan 03 2021; corrected Jun 13 2022
    
  • PARI
    apply( {A340184(n,m=vecmin(n=digits(n)))=#n>1&&forstep(i=#n,1,-1, n[i]==m && return(fromdigits(n[^i])));m}, [1..200]) \\ M. F. Hasler, Jan 03 2021
  • Python
    def A340184(n):
      if n < 10: return 0
      strn = str(n)
      return int("".join(strn.rsplit(min(strn), 1)))
    print([A340184(n) for n in range(90)]) # Michael S. Branicky, Jan 03 2021