OFFSET
0
COMMENTS
Let M(n) = A392736(n) be the Meta-Thue-Morse sequence. Then the pair (M(n), a(n)) encodes sufficient information to compute M(2n) and M(2n+1).
EXAMPLE
For n=0: M(0)=0, so a(0) = M(2*0+1-0) = M(1) = 1.
For n=3: M(3)=0, so a(3) = M(2*3+1-0) = M(7) = 0.
MATHEMATICA
M[0] = 0; M[1] = 1; M[n_] := M[n] = Which[Mod[n, 4] == 0, M[Quotient[n, 4]], Mod[n, 4] == 1, 1 - M[Quotient[n, 4]], Mod[n, 4] == 2, M[2*Quotient[n, 4] + 1 - M[Quotient[n, 4]]], True, 1 - M[2*Quotient[n, 4] + 1 - M[Quotient[n, 4]]]]; Table[M[2n + 1 - M[n]], {n, 0, 79}]
PROG
(PARI) M(n) = if(n<2, n, my(q=n\4, r=n%4); if(r==0, M(q), r==1, 1-M(q), r==2, M(2*q+1-M(q)), 1-M(2*q+1-M(q))));
a(n) = M(2*n + 1 - M(n));
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
John M. Campbell and Benoit Cloitre, Jan 21 2026
STATUS
approved
