login
A179868
(Number of 1's in the binary expansion of n) mod 4.
2
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,4
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.
FORMULA
a(n) = A010873(A000120(n)).
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 *)
PROG
(PARI) a(n)=hammingweight(n)%4 \\ Charles R Greathouse IV, May 09 2016
CROSSREFS
Cf. A000120, A010873, A010060 (mod 2), A071858 (mod 3).
Sequence in context: A376109 A354582 A359312 * A104232 A072086 A180094
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Jan 11 2011
STATUS
approved