How Many Squares Can a String Contain?

All our words (strings) are over afixedalphabet. A square is a subword of the formuu=u2, whereuis a nonempty word. Two squares aredistinctif they are of different shape, not just translates of each other. A worduisprimitiveifucannot be written in the formu=vjfor somej?2. A squareu2withuprimitive isprimitive rooted. LetM(n) denote the maximum number of distinct squares,P(n) the maximum number of distinct primitive rooted squares in a word of length n. We prove: no position in any word can be the beginning of the rightmost occurrence of more than two squares, from which we deduceM(n) 0, andP(n)=n?o(n) for infinitely manyn.

[1]  Aviezri S. Fraenkel,et al.  How Many Squares Must a Binary Sequence Contain? , 1997, Electron. J. Comb..

[2]  Jamie Simpson,et al.  The Exact Number of Squares in Fibonacci Words , 1999, Theor. Comput. Sci..

[3]  H. Wilf,et al.  Uniqueness theorems for periodic functions , 1965 .

[4]  R. C. ENTRINGER,et al.  On Nonrepetitive Sequences , 1974, J. Comb. Theory, Ser. A.

[5]  Wojciech Rytter,et al.  Text Algorithms , 1994 .

[6]  Maxime Crochemore,et al.  An Optimal Algorithm for Computing the Repetitions in a Word , 1981, Inf. Process. Lett..