login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A071858 (Number of 1's in binary expansion of n) mod 3. 7
0, 1, 1, 2, 1, 2, 2, 0, 1, 2, 2, 0, 2, 0, 0, 1, 1, 2, 2, 0, 2, 0, 0, 1, 2, 0, 0, 1, 0, 1, 1, 2, 1, 2, 2, 0, 2, 0, 0, 1, 2, 0, 0, 1, 0, 1, 1, 2, 2, 0, 0, 1, 0, 1, 1, 2, 0, 1, 1, 2, 1, 2, 2, 0, 1, 2, 2, 0, 2, 0, 0, 1, 2, 0, 0, 1, 0, 1, 1, 2, 2, 0, 0, 1, 0, 1, 1, 2, 0, 1, 1, 2, 1, 2, 2, 0, 2, 0, 0, 1, 0, 1, 1, 2, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
This is the generalized Thue-Morse sequence t_3 (Allouche and Shallit, p. 335).
Ternary sequence which is a fixed point of the morphism 0 -> 01, 1 -> 12, 2 -> 20.
Sequence is T^(oo)(0) where T is the operator acting on any word on alphabet {0,1,2} by inserting 1 after 0, 2 after 1 and 0 after 2. For instance T(001)=010112, T(120)=122001. - Benoit Cloitre, Mar 02 2009
REFERENCES
J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003.
LINKS
Jin Chen, Zhixiong Wen, Wen Wu, On the additive complexity of a Thue-Morse like sequence, arXiv:1802.03610 [math.CO], 2018.
FORMULA
a(n) = A010872(A000120(n)).
Recurrence: a(2*n) = a(n), a(2*n+1) = (a(n)+1) mod 3.
a(n) = A000695(n) mod 3. - John M. Campbell, Jul 16 2016
MATHEMATICA
f[n_] := Mod[ Count[ IntegerDigits[n, 2], 1], 3]; Table[ f[n], {n, 0, 104}] (* Or *)
Nest[ Flatten[ # /. {0 -> {0, 1}, 1 -> {1, 2}, 2 -> {2, 0}}] &, {0}, 7] (* Robert G. Wilson v Mar 03 2005, modified May 17 2014 *)
Table[Mod[DigitCount[n, 2, 1], 3], {n, 0, 110}] (* Harvey P. Dale, Jul 01 2015 *)
PROG
(PARI) for(n=1, 200, print1(sum(i=1, length(binary(n)), component(binary(n), i))%3, ", "))
(PARI) map(d)=if(d==2, [2, 0], if(d==1, [1, 2], [0, 1]))
{m=53; v=[]; w=[0]; while(v!=w, v=w; w=[]; for(n=1, min(m, length(v)), w=concat(w, map(v[n])))); for(n=1, 2*m, print1(v[n], ", "))} \\ Klaus Brockhaus, Jun 23 2004
CROSSREFS
See A245555 for another version.
Sequence in context: A038717 A073267 A159981 * A122864 A140084 A243747
KEYWORD
nonn,easy
AUTHOR
Benoit Cloitre, Jun 09 2002
EXTENSIONS
Edited by Ralf Stephan, Dec 11 2004
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 27 15:03 EDT 2024. Contains 372019 sequences. (Running on oeis4.)