|
|
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
|
|
|
FORMULA
|
a(2k+1) = 1, a(4k) = a(2k), a(4k+2) = 2-a(2k). - Michael Somos, Dec 04 2002
a(n) = (number of odious numbers <= n) - (number of evil numbers <= n) for n>0. - T. D. Noe, Jun 14 2007
|
|
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)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|