A160380 a(0) = 0; for n >= 1, a(n) = number of 0's in base-4 representation of n.
0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 1, 1, 1, 1, 0, 0, 0, 1
Offset: 0
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- F. T. Adams-Watters, F. Ruskey, Generating Functions for the Digital Sum and Other Digit Counting Sequences, JIS 12 (2009) 09.5.6
Programs
-
Haskell
import Data.List (unfoldr) a160380 = sum . map ((0 ^ ) . (`mod` 4)) . unfoldr (\x -> if x == 0 then Nothing else Just (x, x `div` 4)) -- Reinhard Zumkeller, Apr 22 2011
-
Mathematica
Join[{0},Table[DigitCount[n,4,0],{n,110}]] (* Harvey P. Dale, Oct 18 2015 *)
-
PARI
a(n) = #select(x->(x==0), digits(n, 4)); \\ Michel Marcus, Apr 26 2021
Formula
Recurrence relation: a(0) = 0, a(4m) = 1+a(m), a(4m+1) = a(4m+2) = a(4m+3) = a(m).
Generating function: (1/(1-z))*Sum_{m>=0} (z^(4^(m+1))*(1 - z^(4^m))/(1 - z^(4^(m+1)))).
Extensions
Definition clarified by Georg Fischer, Apr 26 2021
Comments