OFFSET
1,5
COMMENTS
Define a sequence chf(n) of Christoffel words over an alphabet {-,+}:
chf(1) = '-',
chf(2*n+0) = negate(chf(n)),
chf(2*n+1) = negate(concatenate(chf(n),chf(n+1))).
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
The odd bisection CHF(n) of the chf(n) sequence shifted rightwards by A288002(n) determines the longest overlap of the words CHF(n) and CHF(n+1). Note that the first overlapping letters differ for n == 2^k or equivalently when A288002(n)==0.
To construct the word CHF(n+1) from the word CHF(n): cut off the word negate(lef(n)) of length A288002(n) at the left side of CHF(n), add the word negate(rig(n)) of length a(n) at the right side of CHF(n) and negate the first letter of the new word iff A288002(n)==0.
fusc(n) r-fusc(n) bisection of chf(n)
1 '-' 1 1 '+' 1 '-'
2 '+' 2 1 '-' 1 '+-'
3 '+-' 2 2 '-' 1 '--+'
4 '-' 3 1 '+' 1 '-++'
5 '--+' 3 3 '-+' 2 '+++-'
6 '-+' 3 2 '+' 1 '++-+-'
7 '-++' 3 3 '+' 1 '+-+--'
8 '+' 4 1 '-' 1 '+---'
9 '+++-' 4 4 '++-' 3 '----+'
10 '++-' 4 3 '+-' 2 '---+--+'
11 '++-+-' 4 5 '+-' 2 '--+--+-+'
12 '+-' 4 2 '-' 1 '--+-+-+'
13 '+-+--' 4 5 '+--' 3 '-+-+-++'
14 '+--' 4 3 '-' 1 '-+-++-++'
15 '+---' 4 4 '-' 1 '-++-+++'
16 '-' 5 1 '+' 1 '-++++'
17 '----+' 5 5 '---+' 4 '+++++-'
PROG
(Python)
def l(n): return 0 if n==1 else l(n//2) if n%2==0 else l((n - 1)//2) + r((n - 1)//2)
def r(n): return 1 if n==1 else r(n//2) if n%2==0 else l((n + 1)//2) + r((n + 1)//2)
print([r(n) for n in range(1, 151)]) # Indranil Ghosh, Jun 11 2017
(PARI) l(n)=if(n%2, if(n==1, 0, l(n\2) + a(n\2)), l(n/2))
a(n)=if(n%2, if(n==1, 1, l(n\2+1) + a(n\2+1)), a(n/2)) \\ Charles R Greathouse IV, Jun 11 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
I. V. Serov, Jun 10 2017
STATUS
approved