OFFSET
0,1
COMMENTS
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
EXAMPLE
101 contains two 1s and one 0, therefore a(101) = 2110;
102 contains one 2, one 1 and one 0, therefore a(102) = 121110.
MATHEMATICA
f[n_] := Block[{s = Split@ IntegerDigits@ n}, FromDigits@ Reverse@ Riffle[Union@ Flatten@ s, Length@# & /@ s]]; Array[f, 48, 0] (* Robert G. Wilson v, Dec 01 2016 *)
PROG
(Haskell)
import Data.List (sort, group); import Data.Function (on)
a244112 :: Integer -> Integer
a244112 n = read $ concat $
zipWith ((++) `on` show) (map length xs) (map head xs)
where xs = group $ reverse $ sort $ map (read . return) $ show n
(Python)
def A244112(n):
return int(''.join([str(str(n).count(d))+d for d in '9876543210' if str(n).count(d) > 0])) # Chai Wah Wu, Dec 01 2016
(PARI) A244112(n, c=1, S="")={for(i=2, #n=vecsort(digits(n), , 4), n[i]==n[i-1]&&c++&&next; S=Str(S, c, n[i-1]); c=1); eval(Str(S, c, if(n, n[#n])))} \\ M. F. Hasler, Feb 25 2018
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Nov 11 2014
STATUS
approved