cp's OEIS Frontend

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.

A056979 Number of blocks of {1, 0, 1} in binary expansion of n.

This page as a plain text file.
%I A056979 #22 Feb 16 2025 08:32:43
%S A056979 0,0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,1,2,1,1,0,0,1,1,0,1,0,0,0,0,0,
%T A056979 0,0,1,0,0,1,1,2,2,1,2,1,1,0,0,0,0,1,2,1,1,0,0,1,1,0,1,0,0,0,0,0,0,0,
%U A056979 1,0,0,0,0,1,1,0,1,0,0,1,1,1,1,2,3,2,2,1,1,2,2,1,2,1,1,0,0,0,0,0,1,0
%N A056979 Number of blocks of {1, 0, 1} in binary expansion of n.
%C A056979 a(n) = A213629(n,5) for n > 4. - _Reinhard Zumkeller_, Jun 17 2012
%H A056979 Reinhard Zumkeller, <a href="/A056979/b056979.txt">Table of n, a(n) for n = 1..10000</a>
%H A056979 J.-P. Allouche, J. Shallit, <a href="http://www.math.jussieu.fr/~allouche/kreg2.ps">The Ring of k-regular Sequences II</a>
%H A056979 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/DigitBlock.html">Digit Block</a>
%H A056979 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A056979 a(2n) = a(n), a(2n+1) = a(n) + [n congruent to 2 mod 4]. - _Ralf Stephan_, Aug 22 2003
%t A056979 a[1] = a[2] = 0; a[n_] := a[n] = If[EvenQ[n], a[n/2], a[(n - 1)/2] + Boole[Mod[(n - 1)/2, 4] == 2]]; Table[a[n], {n, 1, 102}] (* _Jean-François Alcover_, Oct 22 2012, after _Ralf Stephan_ *)
%o A056979 (Haskell)
%o A056979 import Data.List (tails, isPrefixOf)
%o A056979 a056979 = sum . map (fromEnum . ([1,0,1] `isPrefixOf`)) .
%o A056979                     tails . a030308_row
%o A056979 -- _Reinhard Zumkeller_, Jun 17 2012
%o A056979 (PARI) a(n) = hammingweight(bitnegimply(bitand(n, n>>2), n>>1));
%o A056979 vector(102, i, a(i))  \\ _Gheorghe Coserea_, Sep 17 2015
%Y A056979 Cf. A014082, A056974, A056975, A056976, A056977, A056978, A056979, A056980.
%K A056979 nonn,easy
%O A056979 1,21
%A A056979 _Eric W. Weisstein_