OFFSET
0,3
COMMENTS
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..10000
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
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Feb 22 2022
STATUS
approved