%I #52 Jun 13 2022 03:01:53
%S 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,
%T 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,
%U 8,9,7,7,7,7,7,7,7,7,8,9,8,8,8,8,8,8,8,8,8,9
%N n with the rightmost occurrence of the smallest digit of n deleted.
%C Suggested by _Eric Angelini_'s posting to Math-Fun Mailing List, Dec. 29, 2020.
%e For n = 32522529, the smallest digit is 2, and its rightmost occurrence is at the tens position, so a(n) = 3252259.
%p leastdigit:=proc(n)
%p min(convert(n,base,10));
%p end:
%p locationdigit:=proc(n,d)
%p local L,i;
%p L:=convert(n,base,10);
%p for i from 1 to nops(L) do
%p if d = L[i] then return (nops(L)+1-i); fi;
%p od:
%p end:
%p cutout:=proc(X,i)
%p [seq(X[j],j=1..i-1),seq(X[j],j=i+1..nops(X))];
%p end:
%p ToNum:=proc(X)
%p add(X[i]*10^(nops(X)-i),i=1..nops(X));
%p end:
%p a:=proc(n)
%p local i,X;
%p i:=locationdigit(n,leastdigit(n));
%p X:=ListTools:-Reverse(convert(n,base,10));
%p ToNum(cutout(X,i));
%p end proc:
%o (Python)
%o def A340184(n):
%o if n < 10: return 0
%o strn = str(n)
%o return int("".join(strn.rsplit(min(strn), 1)))
%o print([A340184(n) for n in range(90)]) # _Michael S. Branicky_, Jan 03 2021
%o (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
%o (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
%Y Cf. A054054 (smallest digit of n).
%K base,easy,dumb,nonn
%O 0,13
%A _W. Edwin Clark_, Jan 02 2021
|