OFFSET
0,1
COMMENTS
For odd n, s_n is palindromic because if s_n = xPx then s_{n+2} = PxxPxPxxP.
a(n) is also the central bit in s_{n+1}.
For any given n, the next 2^n terms after a(n) can be obtained by alternatingly reading the bits from the end and from the start of s_n.
LINKS
Andrei Zabolotskii, Table of n, a(n) for n = 0..20000
FORMULA
For n > 0, a(2*n) = a(2*n-1).
EXAMPLE
s_1 = reverse(10..1) = 101 (where .. is concatenation), so a(1) = 1.
s_2 = reverse(101..10) = 01101, so a(2) = 1.
s_3 = reverse(01101..0110) = 011010110, so a(3) = 0.
Eight more terms can be obtained directly from s_3, without constructing s_4:
a(n) 0 1 1 0 1 0 1 1 0 <- this is s_3
n 4 6 8 10 11 9 7 5 3
PROG
(Python)
s, sr, a = 0b10, 0b01, []
for i in range(11):
a += [s&1]
s, sr = ((sr&((1<<(2**i))-1))<<(2**i+1))+sr, (s<<(2**i))+(s>>1)
for i in range(100):
a += [s&1, s&1]
s >>= 1
print(a)
CROSSREFS
KEYWORD
nonn
AUTHOR
Andrei Zabolotskii, Jan 31 2026
STATUS
approved
