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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A160385 Number of nonzero digits in base-4 representation of n. 3

%I #15 Jan 26 2020 16:34:39

%S 0,1,1,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,2,3,3,3,2,3,3,3,2,3,3,3,1,2,

%T 2,2,2,3,3,3,2,3,3,3,2,3,3,3,1,2,2,2,2,3,3,3,2,3,3,3,2,3,3,3,1,2,2,2,

%U 2,3,3,3,2,3,3,3,2,3,3,3,2,3,3,3,3,4,4,4,3,4,4,4,3,4,4,4,2,3,3,3,3,4,4,4,3

%N Number of nonzero digits in base-4 representation of n.

%H Reinhard Zumkeller, <a href="/A160385/b160385.txt">Table of n, a(n) for n = 0..10000</a>

%H F. T. Adams-Watters, F. Ruskey, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL12/Ruskey2/ruskey14.html">Generating Functions for the Digital Sum and Other Digit Counting Sequences</a>, JIS 12 (2009) 09.5.6

%F Recurrence relation: a(0) = 0, a(4m) = a(m), a(4m+1) = a(4m+2) = a(4m+3) = 1+a(m).

%F Generating function: (1/(1-z)) * Sum_{m>=1} (z^(4^(m-1) - z^(4^m))/(1 - z^(4^m))).

%F Morphism: 0, j -> j,j+1,j+1,j+1; e.g., 0 -> 0111 -> 0111122212221222 -> ...

%o (Haskell)

%o import Data.List (unfoldr)

%o a160385 = sum . map (signum . (`mod` 4)) .

%o unfoldr (\x -> if x == 0 then Nothing else Just (x, x `div` 4))

%o -- _Reinhard Zumkeller_, Apr 22 2011

%K nonn,base,easy

%O 0,6

%A _Frank Ruskey_, Jun 05 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | 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 April 24 22:17 EDT 2024. Contains 371964 sequences. (Running on oeis4.)