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.

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

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 2
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    import Data.List (tails, isPrefixOf)
    a056980 = sum . map (fromEnum . ([0,1,1] `isPrefixOf`)) .
                        tails . a030308_row
    -- Reinhard Zumkeller, Jun 17 2012
    
  • Mathematica
    a[1] = a[2] = 0; a[n_] := a[n] = If[OddQ[n], a[(n - 1)/2], a[n/2] + Boole[Mod[n/2, 4] == 3]]; Table[a[n], {n, 1, 102}] (* Jean-François Alcover, Oct 22 2012, after Ralf Stephan *)
  • PARI
    a(n) = hammingweight(bitnegimply(bitand(n>>1, n>>2), n));
    vector(102, i, a(i))  \\  Gheorghe Coserea, Sep 07 2015

Formula

a(2n) = a(n) + [n congruent to 3 mod 4], a(2n+1) = a(n). - Ralf Stephan, Aug 22 2003
a(n) = A213629(n,6) for n > 5. - Reinhard Zumkeller, Jun 17 2012