OFFSET
1,2
COMMENTS
Two words are conjugate if one is a cyclic shift of the other. A word is squarefree if it contains no block of the form XX, where X is any nonempty block.
Conjecture: a(n) = n for n >= 18. - Michael S. Branicky, Jul 21 2021
The conjecture is true: see Clokie et al. - James Rayman, Feb 14 2023
LINKS
T. Clokie, D. Gabric and J. Shallit Circularly squarefree words and unbordered conjugates: a new approach, arXiv:1904.08187 [cs.FL], Apr 2019
Index entries for linear recurrences with constant coefficients, signature (2,-1).
FORMULA
a(n) = n for n != 5,7,9,10,14,17. - James Rayman, Feb 14 2023
EXAMPLE
For n = 9 the ternary word 012010212 is squarefree, as are three other conjugates of it: {120102120, 201021201, 010212012}, and this is maximal for length 9.
PROG
(Python)
from itertools import product
def isf(s): # incrementally squarefree
for l in range(1, len(s)//2 + 1):
if s[-2*l:-l] == s[-l:]: return False
return True
def aupton(nn, verbose=False):
alst, sfs = [], set("012")
for n in range(1, nn+1):
# max(sum(s[i:]+s[:i] in sfs for i in range(len(s))) for s in sfs)
an = 0
for s in sfs:
sfconjs = 0
for i in range(len(s)):
if s[i:] + s[:i] in sfs: sfconjs += 1
an = max(an, sfconjs)
if an == n: break # short circuit maximum max
sfsnew = set(s+i for s in sfs for i in "012" if isf(s+i))
alst, sfs = alst+[an], sfsnew
if verbose: print(n, an)
return alst
print(aupton(36)) # Michael S. Branicky, Jul 21 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jeffrey Shallit, Jan 10 2019
EXTENSIONS
a(16)-a(59) from Michael S. Branicky, Jul 21 2021
STATUS
approved