login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A355221
The k-th leftmost digit of a(n) is the least of the k leftmost digits of n.
4
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, 22, 22, 22, 22, 30, 31, 32, 33, 33, 33, 33, 33, 33, 33, 40, 41, 42, 43, 44, 44, 44, 44, 44, 44, 50, 51, 52, 53, 54, 55, 55, 55, 55, 55, 60, 61, 62, 63, 64, 65, 66, 66
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: min({1}) = 1, min({1, 4}) = 1, min({1, 4, 0}) = 0, min({1, 4, 0, 2}) = 0, so a(1402) = 1100.
MATHEMATICA
Table[FromDigits[Table[Min[Take[IntegerDigits[n], d]], {d, IntegerLength[n]}]], {n, 0, 70}] (* Harvey P. Dale, Jun 30 2023 *)
PROG
(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) }
(Python)
def a(n):
s, m = str(n), "9"
return int("".join((m:=min(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 A355221(n): return int(''.join(accumulate(str(n), func=min))) # Chai Wah Wu, Jun 25 2022
CROSSREFS
See A355222, A355223 and A355224 for similar sequences.
Cf. A009996 (fixed points), A342126 (binary analog).
Sequence in context: A121759 A265310 A291576 * A180613 A254948 A072778
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Jun 24 2022
STATUS
approved