login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A087116 Number of maximal groups of consecutive zeros in binary representation of n. 15
1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 3, 2, 2, 2, 2, 1, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 3, 2, 2, 2, 2, 1, 2, 2, 3, 2, 3, 3, 3, 2, 2, 2, 3, 2, 2, 2, 2, 1, 1, 1, 2, 1, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,11

COMMENTS

The following four statements are equivalent: a(n) = 0; n = 2^k - 1 for some k; A087117(n) = 0; A023416(n) = 0.

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 0..10000

Index entries for sequences related to binary expansion of n

FORMULA

a(n) = A033264(n) for n > 0 since strings of 0s alternate with strings of 1s. - Jonathan Sondow, Jan 17 2016

a(n) = a(2*n + 1) = a(4*n + 2) - 1, if n>0. - Michael Somos, Nov 04 2016

a(n) = A069010(A003817(n)-n) for n > 0. - Chai Wah Wu, Nov 04 2016

EXAMPLE

G.f. = 1 + x^2 + x^4 + x^5 + x^6 + x^8 + x^9 + 2*x^10 + x^11 + x^12 + x^13 + x^14 + ...

PROG

(Haskell)

a087116 0 = 1

a087116 n = f 0 n where

   f y 0 = y

   f y x = if r == 0 then g x' else f y x'

           where (x', r) = divMod x 2

                 g z = if r == 0 then g z' else f (y + 1) z'

                       where (z', r) = divMod z 2

-- Reinhard Zumkeller, Mar 31 2015

(PARI)

a(n) = if (n == 0, 1, hammingweight(bitxor(n, n>>1)) >> 1);

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

(Python)

def A087116(n):

    return sum(1 for d in bin(n)[2:].split('1') if len(d)) # Chai Wah Wu, Nov 04 2016

CROSSREFS

Cf. A087118, A087119, A087120, A023416, A007088.

Essentially the same as A033264.

Sequence in context: A025449 A047988 A037818 * A033264 A258045 A239302

Adjacent sequences:  A087113 A087114 A087115 * A087117 A087118 A087119

KEYWORD

nonn

AUTHOR

Reinhard Zumkeller, Aug 14 2003

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 22 06:26 EST 2019. Contains 329389 sequences. (Running on oeis4.)