login
Number of blocks of {1, 0, 0} in binary expansion of n.
11

%I #24 Dec 01 2016 12:31:45

%S 0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,1,1,1,1,0,0,0,1,1,0,0,1,0,0,0,1,1,1,

%T 1,2,1,1,1,1,1,0,0,1,0,0,0,1,1,1,1,1,0,0,0,1,1,0,0,1,0,0,0,1,1,1,1,2,

%U 1,1,1,2,2,1,1,2,1,1,1,1,1,1,1,1,0,0,0,1,1,0,0,1,0,0,0,1,1,1,1,2,1,1

%N Number of blocks of {1, 0, 0} in binary expansion of n.

%C a(n) = A213629(n,4) for n > 3. - _Reinhard Zumkeller_, Jun 17 2012

%H Reinhard Zumkeller, <a href="/A056978/b056978.txt">Table of n, a(n) for n = 1..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/DigitBlock.html">Digit Block</a>

%F a(2n) = a(n) + [n congruent to 2 mod 4], a(2n+1) = a(n). - _Ralf Stephan_, Aug 22 2003

%t a[1] = a[2] = 0; a[n_] := a[n] = If[OddQ[n], a[(n-1)/2], a[n/2] + Boole[Mod[n/2, 4] == 2]]; Table[a[n], {n, 1, 102}] (* _Jean-François Alcover_, Oct 22 2012, after _Ralf Stephan_ *)

%t Table[SequenceCount[IntegerDigits[n,2],{1,0,0}],{n,120}] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Dec 01 2016 *)

%o (Haskell)

%o import Data.List (tails, isPrefixOf)

%o a056978 = sum . map (fromEnum . ([0,0,1] `isPrefixOf`)) .

%o tails . a030308_row

%o -- _Reinhard Zumkeller_, Jun 17 2012

%o (PARI)

%o a(n) = hammingweight(bitnegimply(n>>2, bitor(n>>1, n))); \\ _Gheorghe Coserea_, Sep 08 2015

%Y Cf. A014082, A056974, A056975, A056976, A056977, A056978, A056979, A056980.

%K nonn,easy

%O 1,36

%A _Eric W. Weisstein_