OFFSET
0,1
COMMENTS
The Thue-Morse transform T acts on any binary word w with w(0) = 0 in which both 0 and 1 appear infinitely often, by setting T(w)(0) = 0, T(w)(v_w(n)) = T(w)(n) and T(w)(u_w(n)) = 1 - T(w)(n), where v_w(n) and u_w(n) (offset 0) are the positions of the n-th 0 and the n-th 1 of w. Iterating T starting from a_0 = A000035 produces A010060 (T(a_0)), A341389 (T^2(a_0)), A395958 (T^3(a_0)), the present sequence is T^4(a_0).
This sequence is 2-automatic. It is the fixed point starting with 0 of the uniform morphism of length 16 sending 0 -> 0101 0101 0101 0101 and 1 -> 1010 1010 1010 1010.
LINKS
Benoit Cloitre, The Thue-Morse Transform, arXiv:2604.06243 [math.NT], 2026.
FORMULA
a(n) = Sum_{p >= 0, p AND 3 = 0} b_p(n) mod 2, where b_p(n) is the p-th binary digit of n.
a(2n+1) = 1 - a(2n) for n >= 0.
a(16n + r) = a(n) XOR (r mod 2) for 0 <= r < 16 and n >= 0.
PROG
(Python)
def a(n):
s, p = 0, 0
while (1 << p) <= n:
if (p & 3) == 0:
s ^= (n >> p) & 1
p += 1
return s
print([a(n) for n in range(90)])
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Benoit Cloitre, May 12 2026
STATUS
approved
