A355222 The k-th leftmost digit of a(n) is the greatest of the k leftmost digits of n.
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, 26, 27, 28, 29, 33, 33, 33, 33, 34, 35, 36, 37, 38, 39, 44, 44, 44, 44, 44, 45, 46, 47, 48, 49, 55, 55, 55, 55, 55, 55, 56, 57, 58, 59, 66, 66, 66, 66, 66, 66, 66, 67
Offset: 0
Examples
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.
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..10000
Crossrefs
Programs
-
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) }
-
Python
def a(n): s, m = str(n), "0" return int("".join((m:=max(m, s[k])) for k in range(len(s)))) print([a(n) for n in range(68)]) # Michael S. Branicky, Jun 24 2022
-
Python
from itertools import accumulate def A355222(n): return int(''.join(accumulate(str(n),func=max))) # Chai Wah Wu, Jun 25 2022
Formula
a(n) >= n with equality iff n belongs to A009994.
a(a(n)) = a(n).
Comments