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!)
A056980 Number of blocks of {1, 1, 0} in binary expansion of n. 11

%I #25 Feb 21 2023 12:19:13

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

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

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

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

%H Reinhard Zumkeller, <a href="/A056980/b056980.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 3 mod 4], a(2n+1) = a(n). - _Ralf Stephan_, Aug 22 2003

%F a(n) = A213629(n,6) for n > 5. - _Reinhard Zumkeller_, Jun 17 2012

%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] == 3]]; Table[a[n], {n, 1, 102}] (* _Jean-François Alcover_, Oct 22 2012, after _Ralf Stephan_ *)

%o (Haskell)

%o import Data.List (tails, isPrefixOf)

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

%o tails . a030308_row

%o -- _Reinhard Zumkeller_, Jun 17 2012

%o (PARI)

%o a(n) = hammingweight(bitnegimply(bitand(n>>1, n>>2), n));

%o vector(102, i, a(i)) \\ _Gheorghe Coserea_, Sep 07 2015

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

%Y Cf. A213629.

%K nonn,easy,base

%O 1,54

%A _Eric W. Weisstein_

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 18 16:22 EDT 2024. Contains 371780 sequences. (Running on oeis4.)