VOOZH about

URL: https://oeis.org/A298952

⇱ A298952 - OEIS


login
A298952
First put a(n)=0 for all n, then start with a(0) = 1 and add at step n >= 0 the term 1 at position 2*n + a(n).
7
1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0
OFFSET
0
COMMENTS
Sum_{i = 0..n} a(i)/n tends to 1/2 as n tends to infinity. [corrected by Rémy Sigrist, Jan 31 2018]
From Michel Dekking, Sep 07 2020: (Start)
The above limit statement follows from a much stronger property.
Let mu be the 'exchanged' Thue-Morse morphism given by
mu(0) = 10, mu(1) = 01.
CLAIM: a(234...) = mu(a(123...)).
Here a(234...) denotes the word associated to the sequence a(2), a(3), a(4),....
Proof: If a(n)=1 then a(2n+1)=1, and it also follows that a(2n)=0. If a(n)=0 then a(2n)=1, and it also follows that a(2n+1)=0.
This can also be expressed as mu(a(n))=a(2n)a(2n+1). (End)
The sequence is balanced: a(2n) + a(2n+1) = 1 for all n >= 1. Also a(n) agrees with Thue-Morse A010060(n) on dyadic blocks [2^(2k), 2^(2k+1)-1] and is complemented on blocks [2^(2k+1), 2^(2k+2)-1]. The sequence is 4-automatic with a 3-state DFAO. - John M. Campbell and Benoit Cloitre, Jan 21 2026
Like the Thue-Morse sequence (A010060), this sequence produces a fractal turtle walk. For example, with turning angles alpha=90 degrees (if a(n)=0) and beta=150 degrees (if a(n)=1), the walk exhibits self-similar Koch-like structure at every scale (see links for illustrations at 4^4, 4^5, 4^6, 4^7 steps). - Benoit Cloitre, Feb 22 2026
LINKS
John M. Campbell and Benoit Cloitre, Meta-automatic Sequences, arXiv:2602.23395 [math.NT], 2026. See p. 8.
FORMULA
From John M. Campbell and Benoit Cloitre, Jan 21 2026: (Start)
For n >= 1: a(4n) = a(n), a(4n+1) = 1 - a(n), a(4n+2) = a(2n),
a(4n+3) = 1 - a(2n).
a(n) = A010060(n) XOR (floor(log_2(n)) mod 2) for n >= 1. (End)
a(n) = 1 - A059448(n), for n >= 1. - Paolo Xausa, Mar 02 2026
EXAMPLE
Set a(n) = 0.
n = 0, a(0) = 1. Add term 1 at position 2*0+1 = 1. We have {1,1,0,0,0,0,0,0,0,0,...}
n = 1, a(1) = 1. Add term 1 at position 2*1+1 = 3. We have {1,1,0,1,0,0,0,0,0,0,...}
n = 2, a(2) = 0. Add term 1 at position 2*2+0 = 4. We have {1,1,0,1,1,0,0,0,0,0,...}
n = 3, a(3) = 1. Add term 1 at position 2*3+1 = 7. We have {1,1,0,1,1,0,0,1,0,0,...}
and so on.
MATHEMATICA
A298952[n_] := 1 - Mod[DigitCount[n, 2, 0], 2];
Array[A298952, 100, 0] (* Paolo Xausa, Mar 02 2026 *)
PROG
(PARI) a(n) = if(n==0, 1, (logint(n, 2) - hammingweight(n)) % 2); \\ Kevin Ryde, Mar 11 2021
(Python) # Closed form (n >= 1; a(0) = 1 by definition)
def a(n): return 1 if n == 0 else bin(n).count('1') % 2 ^ (n.bit_length() - 1) % 2
print([a(n) for n in range(121)]) # Benoit Cloitre, Feb 22 2026
(Python) # 3-state DFAO (MSB-first, base 4)
def a(n):
if n == 0: return 1
s, digits = 0, []
while n: digits.append(n % 4); n //= 4
for d in reversed(digits):
s = [[0, 2, 1, 2], [1, 2, 2, 1], [2, 1, 1, 2]][s][d]
return [0, 0, 1][s]
print([a(n) for n in range(121)]) # Benoit Cloitre, Feb 22 2026
CROSSREFS
Cf. A059448 (complement), A242179 (values +-1).
Indices of 0's and 1's (except n=0): A059009, A059010.
Cf. A298307.
Sequence in context: A167753 A353816 A141727 * A123594 A286801 A189091
KEYWORD
nonn,easy
AUTHOR
Ctibor O. Zizka, Jan 30 2018
STATUS
approved