login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A355224 The k-th rightmost digit of a(n) is the greatest of the k rightmost digits of n. 4
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, 66, 77, 88, 99, 30, 31, 32, 33, 44, 55, 66, 77, 88, 99, 40, 41, 42, 43, 44, 55, 66, 77, 88, 99, 50, 51, 52, 53, 54, 55, 66, 77, 88, 99, 60, 61, 62, 63, 64, 65, 66, 77 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Leading zeros are ignored.
LINKS
FORMULA
a(n) >= n with equality iff n belongs to A009996.
a(a(n)) = a(n).
EXAMPLE
For n = 1402:
- max({1, 4, 0, 2}) = 4,
- max({4, 0, 2}) = 4,
- max({0, 2}) = 2,
- max({2}) = 2,
- so a(1402) = 4422.
PROG
(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) }
(Python)
def a(n):
s, m = str(n), "0"
return int("".join((m:=max(m, s[-1-k])) for k in range(len(s)))[::-1])
print([a(n) for n in range(68)]) # Michael S. Branicky, Jun 24 2022
(Python)
from itertools import accumulate
def A355224(n): return int(''.join(accumulate(str(n)[::-1], func=max))[::-1]) # Chai Wah Wu, Jun 25 2022
CROSSREFS
See A355221, A355222 and A355223 for similar sequences.
Cf. A009996 (fixed points), A340632 (binary analog).
Sequence in context: A276512 A023792 A221221 * A178354 A179309 A032946
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Jun 24 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 11 12:18 EDT 2024. Contains 372409 sequences. (Running on oeis4.)