TOPICS
Search

Squarefree Word


A squarefree word is a word containing no substring of the form vv, where v is a nonempty finite word. Such a repeated block is called a square (for example, acbacb). For example, abcacbabcb is squarefree, as is the empty word. The only nonempty squarefree binary words are a, b, ab, ba, aba, and bab. Avoiding aa and bb forces alternation, and every alternating word of length four contains abab or baba.

There are arbitrarily long ternary squarefree words. The number s(n) of ternary squarefree words of length n over a fixed three-letter alphabet is given for n=0, 1, 2, ... by 1, 3, 6, 12, 18, 30, 42, 60, ... (OEIS A006156). The exponential growth rate exists and satisfies

 S=lim_(n->infty)[s(n)]^(1/n) approx 1.30176.

The published numerical bounds imply

 1.301759<S<1.301762

(Shur 2012, pp. 2-3).

The number of squarefree quaternary words of length n=1, 2, ... are 4, 12, 36, 96, 264, 696, ... (OEIS A051041).

Avoiding abelian squares is a stronger condition than squarefreeness. An abelian square has two halves with the same letter counts, but they need not be identical. An infinite word avoiding abelian squares requires at least four letters (Salo et al. 2026).


See also

Alphabet, Cubefree Word, Overlapfree Word, Substring, Word

Explore with Wolfram|Alpha

References

Allouche, J.-P. and Shallit, J. "Repetition in Words." §1.6 in Automatic Sequences: Theory, Applications, Generalizations. Cambridge, England: Cambridge University Press, pp. 14-16, 2003.Baake, M.; Elser, V.; and Grimm, U. "The Entropy of Square-Free Words." 8 Sep 1998. https://arxiv.org/abs/math-ph/9809010.Bean, D. R.; Ehrenfeucht, A.; and McNulty, G. F. "Avoidable Patterns in Strings of Symbols." Pacific J. Math. 85, 261-294, 1979.Berstel, J. and Reutenauer, C. "Square-Free Words and Idempotent Semigroups." In Combinatorics on Words (Ed. M. Lothaire). Reading, MA: Addison-Wesley, pp. 18-38, 1983.Brandenburg, F.-J. "Uniformly Growing kth Power-Free Homomorphisms." Theor. Comput. Sci. 23, 69-82, 1983.Brinkhuis, J. "Non-Repetitive Sequences on Three Symbols." Quart. J. Math. Oxford Ser. 2 34, 145-149, 1983.Crochemore, M. "Sharp Characterizations of Squarefree Morphisms." Theor. Comput. Sci. 18, 221-226, 1982.Crochemore, M. "Tests sur les morphismes faiblement sans carré." In Combinatorics on Words (Ed. L. J. Cummings). Toronto, Ontario, Canada: Academic Press, pp. 63-89, 1983.Finch, S. R. "Pattern-Free Word Constants." §5.17 in Mathematical Constants. Cambridge, England: Cambridge University Press, pp. 367-371, 2003.Kobayashi, Y. "Repetition-Free Words." Theor. Comput. Sci. 44, 175-197, 1986.Leconte, M. "kth Power-Free Codes." In Automata on Infinite Words (Ed. M. Nivat and D. Perrin). Berlin, Germany: Springer-Verlag, pp. 172-178, 1985.Noonan, J. and Zeilberger, D. "The Goulden-Jackson Cluster Method: Extensions, Applications, and Implementations." J. Differ. Eq. Appl. 5, 355-377, 1999.Pleasants, P. A. B. "Nonrepetitive Sequences." Proc. Cambridge Philos. Soc. 68, 267-274, 1970.Restivo, A. and Salemi, S. "Overlap-Free Words on Two Symbols." In Automata on Infinite Words (Ed. M. Nivat and D. Perrin). New York: Springer-Verlag, pp. 198-206, 1985.Salo, V.; Vukusic, I.; and Wilson, C. "Avoiding Abelian Squares with Three Colours in the Continuous Setting." 20 Oct 2026. https://arxiv.org/abs/2610.28376.Shur, A. M. "Numerical Values of the Growth Rates of Power-Free Languages." 4 Apr 2012. https://arxiv.org/abs/1009.4415v2.Sloane, N. J. A. Sequences A006156/M2550 and A051041 in "The On-Line Encyclopedia of Integer Sequences."Thue, A. "Über unendliche Zeichenreihen." Norske Vid. Selsk. Skr. I, Mat. Nat. Kl. Christiana 7, 1-22, 1906. Reprinted in Nagell, T.; Selberg, A.; Selberg, S.; and Thalberg, K. (Eds.). Selected Mathematical Papers of Axel Thue. Oslo, Norway: Universitetsforlaget, pp. 139-158, 1977.Thue, A. "Über die gegenseitige Lage gleicher Teile gewisser Zeichenreihen." Norske Vid. Selsk. Skr. I, Mat. Nat. Kl. Christiana 1, 1-67, 1912. Reprinted in Nagell, T.; Selberg, A.; Selberg, S.; and Thalberg, K. (Eds.). Selected Mathematical Papers of Axel Thue. Oslo, Norway: Universitetsforlaget, pp. 413-477, 1977.

Referenced on Wolfram|Alpha

Squarefree Word

Cite this as:

Weisstein, Eric W. "Squarefree Word." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/SquarefreeWord.html

Subject classifications