login
A351868
In the decimal expansion of a number, replace each run of consecutive equal digits, say of k consecutive d's, by the decimal expansion of k*d.
2
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 4, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 6, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 8, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 10, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 12, 67, 68
OFFSET
0,3
COMMENTS
A043096 corresponds to fixed points.
Each number appears at least once in this sequence; zeroless numbers (A052382) appear finitely many times, other positive numbers appear infinitely many times.
LINKS
FORMULA
a(A002275(n)) = n.
EXAMPLE
For n = 1066:
- we have three runs of consecutive equal digits: one 1's, one 0's, two 6's,
- 1 * 1 = 1, 1 * 0 = 0, 2 * 6 = 12,
- we obtain: 1, 0, 12,
- so a(1066) = 1012.
MATHEMATICA
Array[FromDigits@ Flatten@ Map[If[Length[#] == 1, #[[1]], IntegerDigits[Length[#]*#[[1]]]] &, Split@ IntegerDigits[#]] &, 69, 0] (* Michael De Vlieger, Feb 25 2022 *)
PROG
(PARI) a(n, base=10) = { my (d=[]); while (n, my (t=n%base); for (k=0, oo, if (n%base!=t, d=concat(if (t, digits(k*t, base), [0]), d); break, n\=base))); fromdigits(d, base) }
(Python)
from itertools import groupby
def a(n): return int("".join(str(int(k)*len(list(g))) for k, g in groupby(str(n))))
print([a(n) for n in range(69)]) # Michael S. Branicky, Feb 23 2022
CROSSREFS
Cf. A002275, A043096 (fixed points), A052382, A113589, A175930, A351870.
Sequence in context: A043270 A089898 A071785 * A325721 A079050 A320109
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Feb 22 2022
STATUS
approved