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!)
A076826 a(n) = 2*(Sum_{k=0..n} A010060(k)) - n, where A010060 is a Thue-Morse sequence. 7
0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 2, 1, 2, 1, 0, 1, 2, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Is there any interesting sequence b(n) such that b(n) mod 3 = a(n)?
Fixed point of the morphism 0->012; 1->1; 2->210 starting with a(0) = 0. - Philippe Deléham, Mar 14 2004
LINKS
Hsien-Kuei Hwang, Svante Janson, and Tsung-Hsi Tsai, Identities and periodic oscillations of divide-and-conquer recurrences splitting at half, arXiv:2210.10968 [cs.DS], 2022, p. 52.
FORMULA
a(2k+1) = 1, a(4k) = a(2k), a(4k+2) = 2-a(2k). - Michael Somos, Dec 04 2002
a(2n) = 2*A010060(n); a(2n+1) = 1. - Benoit Cloitre, Mar 08 2004
a(n) = 2*(A026430(n+1) - 1) mod 3. - Philippe Deléham, Mar 28 2004
a(n) = (number of odious numbers <= n) - (number of evil numbers <= n) for n>0. - T. D. Noe, Jun 14 2007
a(n) = 2*A115384(n) - n. - Vladimir Shevelev, May 31 2009
a(n) = 0 if n and A000120(n) are even; a(n) = 2 if n is even but A000120(n) is odd; a(n) = 1 if n is odd. - Vladimir Shevelev, May 31 2009
MATHEMATICA
Nest[ Function[ l, {Flatten[(l /. {0 -> {0, 1, 2}, 1 -> {1}, 2 -> {2, 1, 0}}) ]}], {0}, 6] (* Robert G. Wilson v, Mar 03 2005 *)
cnt=0; Join[{0}, Table[If[EvenQ[Count[IntegerDigits[n, 2], 1]], cnt--, cnt++ ]; cnt, {n, 150}]] (* T. D. Noe, Jun 14 2007 *)
PROG
(PARI) a(n)=if(n<0, 0, 2*sum(k=1, n, subst(Pol(binary(k)), x, 1)%2)-n)
(PARI) a(n)=if(n<1, 0, if(n%2, 1, if(n/2%2, 2-a(n\4*2), a(n/2))))
(Python)
def A076826(n): return 1 if n&1 else (n.bit_count()&1)<<1 # Chai Wah Wu, Mar 01 2023
CROSSREFS
Cf. A000069 (odious numbers), A001969 (evil numbers).
Sequence in context: A276469 A272356 A102565 * A137178 A101666 A035224
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Nov 24 2002
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 May 5 23:48 EDT 2024. Contains 372290 sequences. (Running on oeis4.)