The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A105098 Minimum number of squares (repeated adjacent nonempty subwords) in a binary string of length n. 1
0, 0, 0, 1, 1, 2, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 20, 20 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,6
COMMENTS
This sequence counts "occurrences" of (possibly identical) squares, overlaps allowed. See Kucherov et al. link. - Michael S. Branicky, Dec 20 2020
LINKS
G. Kucherov, P. Ochem and M. Rao, How many square occurrences must a binary sequence contain?, Electronic Journal of Combinatorics V. 10 (2003), paper #R12.
EXAMPLE
a(4) = 1 because every string of length > 3 contains at least one square and 0100 contains only one square.
PROG
(Python)
from itertools import product
def count_overlaps(subs, s):
c = i = 0
while i != -1:
i = s.find(subs, i)
if i != -1: c += 1; i += 1
return c
def a(n):
if n == 1: return 0
squares = ["".join(u) + "".join(u)
for r in range(1, n//2 + 1) for u in product("01", repeat = r)]
words = ("0"+"".join(w) for w in product("10", repeat=n-1))
themin = n*n
for w in words:
numw = 0
for s in squares:
numw += count_overlaps(s, w)
if numw >= themin: break
else: themin = min(themin, numw)
return themin
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Dec 20 2020
CROSSREFS
Sequence in context: A300076 A029113 A244988 * A303003 A063124 A358901
KEYWORD
nonn,hard,more
AUTHOR
Jeffrey Shallit, Apr 07 2005
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 27 00:30 EDT 2024. Contains 372847 sequences. (Running on oeis4.)