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!)
A056977 Number of blocks of {0, 1, 1} in binary expansion of n. 10
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,91

LINKS

Gheorghe Coserea, Table of n, a(n) for n = 1..10000

Eric Weisstein's World of Mathematics, Digit Block

FORMULA

a(2n) = a(n), a(2n+1) = a(n) + [n>1 and n congruent to 1 mod 4]. - Ralf Stephan, Aug 22 2003

MATHEMATICA

a[n_, bits_] := (idn = IntegerDigits[n, 2]; ln = Length[idn]; lb = Length[bits]; For[cnt = 0; k = 1, k <= ln - lb + 1, k++, If[idn[[k ;; k + lb - 1]] == bits, cnt++]]; cnt); Table[ a[n, {0, 1, 1}], {n, 1, 102} ] (* Jean-François Alcover, Oct 23 2012 *)

Table[SequenceCount[IntegerDigits[n, 2], {0, 1, 1}], {n, 120}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 03 2019 *)

PROG

(PARI)

a(n) = {

if (n < 11, return(0));

my(k = logint(n, 2) - 1);

hammingweight(bitnegimply(bitand(n>>1, n), n>>2)) - bittest(n, k)

};

vector(102, i, a(i)) \\ Gheorghe Coserea, Sep 17 2015

CROSSREFS

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

Sequence in context: A277007 A160380 A122433 * A309144 A085425 A355685

Adjacent sequences: A056974 A056975 A056976 * A056978 A056979 A056980

KEYWORD

nonn,easy

AUTHOR

Eric W. Weisstein

STATUS

approved

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 March 1 00:55 EST 2023. Contains 360748 sequences. (Running on oeis4.)