cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A160385 Number of nonzero digits in base-4 representation of n.

This page as a plain text file.
%I A160385 #15 Jan 26 2020 16:34:39
%S A160385 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 A160385 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 A160385 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 A160385 Number of nonzero digits in base-4 representation of n.
%H A160385 Reinhard Zumkeller, <a href="/A160385/b160385.txt">Table of n, a(n) for n = 0..10000</a>
%H A160385 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 A160385 Recurrence relation: a(0) = 0, a(4m) = a(m), a(4m+1) = a(4m+2) = a(4m+3) = 1+a(m).
%F A160385 Generating function: (1/(1-z)) * Sum_{m>=1} (z^(4^(m-1) - z^(4^m))/(1 - z^(4^m))).
%F A160385 Morphism: 0, j -> j,j+1,j+1,j+1; e.g., 0 -> 0111 -> 0111122212221222 -> ...
%o A160385 (Haskell)
%o A160385 import Data.List (unfoldr)
%o A160385 a160385 = sum . map (signum . (`mod` 4)) .
%o A160385 unfoldr (\x -> if x == 0 then Nothing else Just (x, x `div` 4))
%o A160385 -- _Reinhard Zumkeller_, Apr 22 2011
%K A160385 nonn,base,easy
%O A160385 0,6
%A A160385 _Frank Ruskey_, Jun 05 2009