OFFSET
1,5
COMMENTS
LINKS
Jeffrey Shallit, Intertwining of Complementary Thue-Morse Factors, arxiv preprint arXiv:2203.02917 [cs.FL], March 6 2022.
FORMULA
a(n) = A060973(n-1) for n >= 1.
EXAMPLE
For n = 4, the only block with intertwining sequence ABBA ABBA ... is 0011.
MATHEMATICA
a[n_] := a[n] = Switch[n, 1|2, 0, 3, 1, n, If[Mod[n, 2] == 1, 2*a[(n+1)/2//Floor], a[n/2//Floor] + a[1+n/2//Floor]]];
Table[a[n], {n, 1, 78}] (* Jean-François Alcover, Mar 25 2023
PROG
(Python) # Recurrence from Henry Bottomley in A060973.
from functools import cache
@cache
def a(n):
match n:
case 1 | 2: return 0
case 3: return 1
case n if n % 2 == 1: return 2*a((n+1)//2)
case _: return a(n//2) + a(1+n//2)
print([a(n) for n in range(1, 73)]) # Peter Luschny, Mar 08 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeffrey Shallit, Mar 08 2022
STATUS
approved