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 A056974 #26 Feb 16 2025 08:32:43 %S A056974 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,3,2,1, %T A056974 1,0,0,0,0,1,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,4,3,2,2,1, %U A056974 1,1,1,1,0,0,0,0,0,0,0,2,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,3,2,1,1,0,0,0 %N A056974 Number of blocks of {0, 0, 0} in the binary expansion of n. %C A056974 Overlaps count. For example, 64 in binary is 1000000, which means that a(64) = 4, not 2. - _Harvey P. Dale_, Jan 10 2016 %H A056974 Antti Karttunen, <a href="/A056974/b056974.txt">Table of n, a(n) for n = 1..65537</a> %H A056974 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/DigitBlock.html">Digit Block</a> %H A056974 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A056974 a(1) = 0, and then after, a(2n) = a(n) + [n congruent to 0 mod 8], a(2n+1) = a(n). - _Ralf Stephan_, Aug 22 2003, corrected by _Antti Karttunen_, Oct 10 2017 %t A056974 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, 0, 0}], {n, 1, 102} ] (* _Jean-François Alcover_, Oct 23 2012 *) %t A056974 Table[SequenceCount[IntegerDigits[n,2],{0,0,0},Overlaps->True],{n,110}] (* The program uses the SequenceCount function from Mathematica version 10 *) (* _Harvey P. Dale_, Jan 10 2016 *) %o A056974 (PARI) a(n)=my(v=binary(n));sum(i=3,#v,v[i]+v[i-1]+v[i-2]==0) \\ _Charles R Greathouse IV_, Dec 07 2011 %o A056974 (PARI) %o A056974 a(n) = { %o A056974 my(x = bitor(n, bitor(n>>1, n>>2))); %o A056974 if (x == 0, 0, 1 + logint(x, 2) - hammingweight(x)) %o A056974 }; %o A056974 vector(102, i, a(i)) \\ _Gheorghe Coserea_, Sep 17 2015 %o A056974 (Scheme) %o A056974 ;; This uses Ralf Stephan's recurrence and memoization-macro definec: %o A056974 (definec (A056974 n) (cond ((= 1 n) 0) ((even? n) (+ (if (zero? (modulo n 8)) 1 0) (A056974 (/ n 2)))) (else (A056974 (/ (- n 1) 2))))) ;; _Antti Karttunen_, Oct 10 2017 %Y A056974 Cf. A014082, A056974, A056975, A056976, A056977, A056978, A056979, A056980. %K A056974 nonn,base,easy %O A056974 1,16 %A A056974 _Eric W. Weisstein_