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.

A179868 (Number of 1's in the binary expansion of n) mod 4.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jan 11 2011

Keywords

Comments

This is the generalized Thue-Morse sequence t_4 (Allouche and Shallit, p. 335).

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003.

Crossrefs

Cf. A000120, A010873, A010060 (mod 2), A071858 (mod 3).

Programs

  • Mathematica
    Nest[ Flatten[ # /. {0 -> {0, 1}, 1 -> {1, 2}, 2 -> {2, 3}, 3 -> {3, 0}}] &, {0}, 7] (* Robert G. Wilson v, May 17 2014 *)
    Table[Mod[DigitCount[n,2,1],4],{n,0,110}] (* Harvey P. Dale, Jul 24 2016 *)
  • PARI
    a(n)=hammingweight(n)%4 \\ Charles R Greathouse IV, May 09 2016

Formula

a(n) = A010873(A000120(n)).