login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


Replace each digit with its number of occurrences in decimal representation of n.
8

%I #15 Mar 31 2017 20:45:54

%S 1,1,1,1,1,1,1,1,1,1,11,22,11,11,11,11,11,11,11,11,11,11,22,11,11,11,

%T 11,11,11,11,11,11,11,22,11,11,11,11,11,11,11,11,11,11,22,11,11,11,11,

%U 11,11,11,11,11,11,22,11,11,11,11,11,11,11,11,11,11,22,11,11,11,11,11,11

%N Replace each digit with its number of occurrences in decimal representation of n.

%C A055642(a(n)) = A055642(n) for n < (10^10-1)/9; fixed points: a(A108571(n)) = A108571(n).

%H R. Zumkeller, <a href="/A139337/b139337.txt">Table of n, a(n) for n = 0..25000</a>

%e a(373) = 212, since, reading the digits of 373 from left to right, 3 appeared twice, 7 once, 3 twice.

%t a[n_] := IntegerDigits[n] /. Thread[{1, 2, 3, 4, 5, 6, 7, 8, 9, 0} -> DigitCount[n]] // FromDigits; Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Nov 28 2013 *)

%o (Haskell)

%o import Data.List (group, sort); import Data.Maybe (mapMaybe)

%o a139337 n = read $ concatMap show $ mapMaybe (flip lookup ls) ds :: Int

%o where ls = zip (map head zss) (map length zss)

%o zss = group $ sort ds

%o ds = map (read . return) $ show n :: [Int]

%o -- _Reinhard Zumkeller_, Mar 14 2014

%K nonn,base,look

%O 0,11

%A _Reinhard Zumkeller_, Apr 14 2008

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 21 04:44 EDT 2024. Contains 376079 sequences. (Running on oeis4.)