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.

A355224 The k-th rightmost digit of a(n) is the greatest of the k rightmost digits of n.

This page as a plain text file.
%I A355224 #16 Nov 17 2024 16:09:30
%S A355224 0,1,2,3,4,5,6,7,8,9,10,11,22,33,44,55,66,77,88,99,20,21,22,33,44,55,
%T A355224 66,77,88,99,30,31,32,33,44,55,66,77,88,99,40,41,42,43,44,55,66,77,88,
%U A355224 99,50,51,52,53,54,55,66,77,88,99,60,61,62,63,64,65,66,77
%N A355224 The k-th rightmost digit of a(n) is the greatest of the k rightmost digits of n.
%C A355224 Leading zeros are ignored.
%H A355224 Rémy Sigrist, <a href="/A355224/b355224.txt">Table of n, a(n) for n = 0..10000</a>
%F A355224 a(n) >= n with equality iff n belongs to A009996.
%F A355224 a(a(n)) = a(n).
%e A355224 For n = 1402:
%e A355224 - max({1, 4, 0, 2}) = 4,
%e A355224 - max({4, 0, 2}) = 4,
%e A355224 - max({0, 2}) = 2,
%e A355224 - max({2}) = 2,
%e A355224 - so a(1402) = 4422.
%t A355224 Table[FromDigits[Max/@Table[Drop[IntegerDigits[m],n],{n,0,IntegerLength[m]-1}]],{m,0,70}] (* _Harvey P. Dale_, Nov 17 2024 *)
%o A355224 (PARI) a(n, base=10) = { my (d=digits(n, base), m=-oo); forstep (k=#d, 1, -1, d[k]=m=max(m, d[k])); fromdigits(d, base) }
%o A355224 (Python)
%o A355224 def a(n):
%o A355224     s, m = str(n), "0"
%o A355224     return int("".join((m:=max(m, s[-1-k])) for k in range(len(s)))[::-1])
%o A355224 print([a(n) for n in range(68)]) # _Michael S. Branicky_, Jun 24 2022
%o A355224 (Python)
%o A355224 from itertools import accumulate
%o A355224 def A355224(n): return int(''.join(accumulate(str(n)[::-1],func=max))[::-1]) # _Chai Wah Wu_, Jun 25 2022
%Y A355224 See A355221, A355222 and A355223 for similar sequences.
%Y A355224 Cf. A009996 (fixed points), A340632 (binary analog).
%K A355224 nonn,base,easy
%O A355224 0,3
%A A355224 _Rémy Sigrist_, Jun 24 2022