login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Please make a donation to keep the OEIS running. We are now in our 56th year. In the past year we added 10000 new sequences and reached almost 9000 citations (which often say "discovered thanks to the OEIS").
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A087117 Number of zeros in the longest string of consecutive zeros in the binary representation of n. 20
1, 0, 1, 0, 2, 1, 1, 0, 3, 2, 1, 1, 2, 1, 1, 0, 4, 3, 2, 2, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 0, 5, 4, 3, 3, 2, 2, 2, 2, 3, 2, 1, 1, 2, 1, 1, 1, 4, 3, 2, 2, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 0, 6, 5, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 4, 3, 2, 2, 2, 1, 1, 1, 3, 2, 1, 1, 2, 1, 1, 1, 5, 4, 3, 3, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,5

COMMENTS

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

The k-th composition in standard order (row k of A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. Then a(k) is the maximum part of this composition, minus one. The maximum part is A333766(k). - Gus Wiseman, Apr 09 2020

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) = max(A007814(n), a(A025480(n-1))) for n >= 2. - Robert Israel, Feb 19 2017

a(2n+1) = a(n) (n>=1); indeed, the binary form of 2n+1 consists of the binary form of n with an additional 1 at the end - Emeric Deutsch, Aug 18 2017

For n > 0, a(n) = A333766(n) - 1. - Gus Wiseman, Apr 09 2020

MAPLE

A087117 := proc(n)

    local d, l, zlen ;

    if n = 0 then

        return 1 ;

    end if;

    d := convert(n, base, 2) ;

    for l from nops(d)-1 to 0 by -1 do

        zlen := [seq(0, i=1..l)] ;

        if verify(zlen, d, 'sublist') then

            return l ;

        end if;

    end do:

    return 0 ;

end proc; # R. J. Mathar, Nov 05 2012

MATHEMATICA

nz[n_]:=Max[Length/@Select[Split[IntegerDigits[n, 2]], MemberQ[#, 0]&]]; Array[nz, 110, 0]/.-\[Infinity]->0 (* Harvey P. Dale, Sep 05 2017 *)

PROG

(Haskell)

import Data.List (unfoldr, group)

a087117 0       = 1

a087117 n

  | null $ zs n = 0

  | otherwise   = maximum $ map length $ zs n where

  zs = filter ((== 0) . head) . group .

       unfoldr (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2)

-- Reinhard Zumkeller, May 01 2012

CROSSREFS

Cf. A023416, A007088, A007814.

Cf. A025480, A038374, A090046, A090047, A090048, A090049, A090050.

Positions of zeros are A000225.

Positions of terms <= 1 are A003754.

Positions of terms > 0 are A062289.

Positions of first appearances are A131577.

The version for prime indices is A252735.

The proper maximum is A333766.

The version for minimum is A333767.

Maximum prime index is A061395.

All of the following pertain to compositions in standard order (A066099):

- Length is A000120.

- Sum is A070939.

- Runs are counted by A124767.

- Strict compositions are A233564.

- Constant compositions are A272919.

- Runs-resistance is A333628.

- Weakly decreasing compositions are A114994.

- Weakly increasing compositions are A225620.

- Strictly decreasing compositions are A333255.

- Strictly increasing compositions are A333256.

Cf. A029931, A048793, A061395, A087117, A228351, A328594, A333217, A333218, A333219, A333767, A333768.

Sequence in context: A144789 A285097 A279209 * A029340 A288166 A126258

Adjacent sequences:  A087114 A087115 A087116 * A087118 A087119 A087120

KEYWORD

nonn,base

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 26 12:37 EST 2020. Contains 338639 sequences. (Running on oeis4.)