login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

The k-th leftmost digit of a(n) is the least of the k leftmost digits of n.
4

%I #18 Jun 30 2023 15:49:57

%S 0,1,2,3,4,5,6,7,8,9,10,11,11,11,11,11,11,11,11,11,20,21,22,22,22,22,

%T 22,22,22,22,30,31,32,33,33,33,33,33,33,33,40,41,42,43,44,44,44,44,44,

%U 44,50,51,52,53,54,55,55,55,55,55,60,61,62,63,64,65,66,66

%N The k-th leftmost digit of a(n) is the least of the k leftmost digits of n.

%C Leading zeros are ignored.

%H Rémy Sigrist, <a href="/A355221/b355221.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) <= n with equality iff n belongs to A009996.

%F a(a(n)) = a(n).

%e For n = 1402: min({1}) = 1, min({1, 4}) = 1, min({1, 4, 0}) = 0, min({1, 4, 0, 2}) = 0, so a(1402) = 1100.

%t Table[FromDigits[Table[Min[Take[IntegerDigits[n],d]],{d,IntegerLength[n]}]],{n,0,70}] (* _Harvey P. Dale_, Jun 30 2023 *)

%o (PARI) a(n, base=10) = { my (d=digits(n, base), m=oo); for (k=1, #d, d[k]=m=min(m, d[k])); fromdigits(d, base) }

%o (Python)

%o def a(n):

%o s, m = str(n), "9"

%o return int("".join((m:=min(m, s[k])) for k in range(len(s))))

%o print([a(n) for n in range(68)]) # _Michael S. Branicky_, Jun 24 2022

%o (Python)

%o from itertools import accumulate

%o def A355221(n): return int(''.join(accumulate(str(n),func=min))) # _Chai Wah Wu_, Jun 25 2022

%Y See A355222, A355223 and A355224 for similar sequences.

%Y Cf. A009996 (fixed points), A342126 (binary analog).

%K nonn,base,easy

%O 0,3

%A _Rémy Sigrist_, Jun 24 2022