|
|
A355223
|
|
The k-th rightmost digit of a(n) is the least of the k rightmost digits of n.
|
|
4
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 11, 22, 23, 24, 25, 26, 27, 28, 29, 0, 11, 22, 33, 34, 35, 36, 37, 38, 39, 0, 11, 22, 33, 44, 45, 46, 47, 48, 49, 0, 11, 22, 33, 44, 55, 56, 57, 58, 59, 0, 11, 22, 33, 44, 55, 66, 67, 68
(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 A009994.
a(a(n)) = a(n).
a(n) = 0 iff n is a multiple of 10.
|
|
EXAMPLE
|
For n = 1402:
- min({1, 4, 0, 2}) = 0,
- min({4, 0, 2}) = 0,
- min({0, 2}) = 0,
- min({2}) = 2,
- so a(1402) = 2.
|
|
PROG
|
(PARI) a(n, base=10) = { my (d=digits(n, base), m=oo); forstep (k=#d, 1, -1, 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[-1-k])) for k in range(len(s)))[::-1])
(Python)
from itertools import accumulate
def A355223(n): return int(''.join(accumulate(str(n)[::-1], func=min))[::-1]) # Chai Wah Wu, Jun 25 2022
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|