This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A087117 #31 Apr 14 2022 16:23:15 %S A087117 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, %T A087117 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, %U A087117 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 %N A087117 Number of zeros in the longest string of consecutive zeros in the binary representation of n. %C A087117 The following four statements are equivalent: a(n) = 0; n = 2^k - 1 for some k > 0; A087116(n) = 0; A023416(n) = 0. %C A087117 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 %H A087117 Reinhard Zumkeller, <a href="/A087117/b087117.txt">Table of n, a(n) for n = 0..10000</a> %H A087117 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A087117 a(n) = max(A007814(n), a(A025480(n-1))) for n >= 2. - _Robert Israel_, Feb 19 2017 %F A087117 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 %F A087117 For n > 0, a(n) = A333766(n) - 1. - _Gus Wiseman_, Apr 09 2020 %p A087117 A087117 := proc(n) %p A087117 local d,l,zlen ; %p A087117 if n = 0 then %p A087117 return 1 ; %p A087117 end if; %p A087117 d := convert(n,base,2) ; %p A087117 for l from nops(d)-1 to 0 by -1 do %p A087117 zlen := [seq(0,i=1..l)] ; %p A087117 if verify(zlen,d,'sublist') then %p A087117 return l ; %p A087117 end if; %p A087117 end do: %p A087117 return 0 ; %p A087117 end proc; # _R. J. Mathar_, Nov 05 2012 %t A087117 nz[n_]:=Max[Length/@Select[Split[IntegerDigits[n,2]],MemberQ[#,0]&]]; Array[nz,110,0]/.-\[Infinity]->0 (* _Harvey P. Dale_, Sep 05 2017 *) %o A087117 (Haskell) %o A087117 import Data.List (unfoldr, group) %o A087117 a087117 0 = 1 %o A087117 a087117 n %o A087117 | null $ zs n = 0 %o A087117 | otherwise = maximum $ map length $ zs n where %o A087117 zs = filter ((== 0) . head) . group . %o A087117 unfoldr (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2) %o A087117 -- _Reinhard Zumkeller_, May 01 2012 %o A087117 (PARI) h(n)=if(n<2, return(0)); my(k=valuation(n,2)); if(k, max(h(n>>k), k), n++; n>>=valuation(n,2); h(n-1)) %o A087117 a(n)=if(n,h(n),1) \\ _Charles R Greathouse IV_, Apr 06 2022 %Y A087117 Cf. A023416, A007088, A007814. %Y A087117 Cf. A025480, A038374, A090046, A090047, A090048, A090049, A090050. %Y A087117 Positions of zeros are A000225. %Y A087117 Positions of terms <= 1 are A003754. %Y A087117 Positions of terms > 0 are A062289. %Y A087117 Positions of first appearances are A131577. %Y A087117 The version for prime indices is A252735. %Y A087117 The proper maximum is A333766. %Y A087117 The version for minimum is A333767. %Y A087117 Maximum prime index is A061395. %Y A087117 All of the following pertain to compositions in standard order (A066099): %Y A087117 - Length is A000120. %Y A087117 - Sum is A070939. %Y A087117 - Runs are counted by A124767. %Y A087117 - Strict compositions are A233564. %Y A087117 - Constant compositions are A272919. %Y A087117 - Runs-resistance is A333628. %Y A087117 - Weakly decreasing compositions are A114994. %Y A087117 - Weakly increasing compositions are A225620. %Y A087117 - Strictly decreasing compositions are A333255. %Y A087117 - Strictly increasing compositions are A333256. %Y A087117 Cf. A029931, A048793, A061395, A087117, A228351, A328594, A333217, A333218, A333219, A333767, A333768. %K A087117 nonn,base,easy %O A087117 0,5 %A A087117 _Reinhard Zumkeller_, Aug 14 2003