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.
%I A355222 #12 Jun 26 2022 09:15:31 %S A355222 0,1,2,3,4,5,6,7,8,9,11,11,12,13,14,15,16,17,18,19,22,22,22,23,24,25, %T A355222 26,27,28,29,33,33,33,33,34,35,36,37,38,39,44,44,44,44,44,45,46,47,48, %U A355222 49,55,55,55,55,55,55,56,57,58,59,66,66,66,66,66,66,66,67 %N A355222 The k-th leftmost digit of a(n) is the greatest of the k leftmost digits of n. %C A355222 Leading zeros are ignored. %H A355222 Rémy Sigrist, <a href="/A355222/b355222.txt">Table of n, a(n) for n = 0..10000</a> %F A355222 a(n) >= n with equality iff n belongs to A009994. %F A355222 a(a(n)) = a(n). %e A355222 For n = 1402: max({1}) = 1, max({1, 4}) = 4, max({1, 4, 0}) = 4, max({1, 4, 0, 2}) = 4, so a(1402) = 1444. %o A355222 (PARI) a(n, base=10) = { my (d=digits(n, base), m=-oo); for (k=1, #d, d[k]=m=max(m, d[k])); fromdigits(d, base) } %o A355222 (Python) %o A355222 def a(n): %o A355222 s, m = str(n), "0" %o A355222 return int("".join((m:=max(m, s[k])) for k in range(len(s)))) %o A355222 print([a(n) for n in range(68)]) # _Michael S. Branicky_, Jun 24 2022 %o A355222 (Python) %o A355222 from itertools import accumulate %o A355222 def A355222(n): return int(''.join(accumulate(str(n),func=max))) # _Chai Wah Wu_, Jun 25 2022 %Y A355222 See A355221, A355223 and A355224 for similar sequences. %Y A355222 Cf. A003817 (binary analog), A009994 (fixed points). %K A355222 nonn,base,easy %O A355222 0,3 %A A355222 _Rémy Sigrist_, Jun 24 2022