login
Tally the digits of n: list the distinct digits of n in order of appearance, each followed by the respective count, concatenate.
1

%I #14 Dec 13 2019 13:25:00

%S 1,11,21,31,41,51,61,71,81,91,1101,12,1121,1131,1141,1151,1161,1171,

%T 1181,1191,2101,2111,22,2131,2141,2151,2161,2171,2181,2191,3101,3111,

%U 3121,32,3141,3151,3161,3171,3181,3191,4101,4111,4121,4131,42,4151,4161,4171,4181,4191,5101,5111

%N Tally the digits of n: list the distinct digits of n in order of appearance, each followed by the respective count, concatenate.

%C The term a(0) = 1 means 01 without the leading zero; no other number is affected by this problem of the leading zero.

%C Similar to the "Look & Say" operation LS = A045918, in which the count precedes the digit. However, here each distinct digit is considered only once: Thus, while LS(121) = 111211, a(121) = 1221 ("digit 1 twice, digit 2 once").

%F If n is in A010784 (has only distinct digits), then a(n) = (n with an additional digit 1 inserted after each digit).

%e a(1) = 11 for "digit 1, once".

%e a(10) = 1101 for "digit 1, once; digit 0, once".

%e a(11) = 12 for "digit 1, twice".

%e a(12) = 1121 for "digit 1, once; digit 2, once".

%e a(100) = 1102 for "digit 1, once; digit 0, twice".a(111) = 13, for "digit 1, three times".

%t A330286[n_] := FromDigits@ Flatten@ IntegerDigits@ Flatten@ Tally@ IntegerDigits[n];

%t Table[A330286[n], {n, 0, 50}]

%o (PARI) apply( a(n)={eval(concat(vector(#n=digits(n), i, if(!setsearch(Set(n[1..i-1]), n[i]), Str(n[i],#select(d->d==n[i], n)), ""))))}, [1..111])

%Y Cf. A045918 (look and say), A010784.

%K nonn,base,less

%O 0,2

%A _M. F. Hasler_, Dec 09 2019