Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

A fundamental topic in Combinatorics on Words is the study of repetitions. A repetition in a word is a factor that is formed by the concatenation of two or more identical blocks. The simplest kind of repetition is a square, that is the concatenation of two copies of the same block, like sciascia. A famous conjecture of Fraenkel and Simpson [1] states that a word of length n contains less than n distinct square factors. Experiments strongly suggest that the conjecture is true, but a theoretical proof of the conjecture seems difficult. In [1], the authors proved a bound of 2n. In [2], Ilie improved this bound to \(2n-\varTheta (\log n)\), but the conjectured bound is still far away.

Among the different generalizations of the notion of repetition, a prominent one is that of an abelian repetition. An abelian repetition in a word is a factor that is formed by the concatenation of two or more blocks that have the same number of occurrences of each letter in the alphabet. Of course, the simplest kind of abelian repetition is an abelian square, that is therefore the concatenation of a word with an anagram of itself, like viavai. Abelian squares were considered in 1961 by Erdös [3], who conjectured that there exist infinite words avoiding abelian squares (this conjecture has later been proved to be true, and the smallest possible size of an alphabet for which it holds has been proved to be 4 [4]).

We focus on the maximum number of abelian squares that a word can contain. Opposite to case of ordinary squares, a word of length n can contain \(\varTheta (n^2)\) distinct abelian square factors (see [5]). Since the total number of factors in a word of length n is quadratic in n, this means that there exist words in which a fixed proportion of all factors are abelian squares. So we turn our attention to infinite words, and we wonder whether there exist infinite words such that for every n any factor of length n contains, on average, a number of abelian squares that is quadratic in n. We call such an infinite word abelian-square rich. Since a random binary word of length n contains \(\varTheta (n\sqrt{n})\) distinct abelian square factors [6], the existence of abelian-square rich words is not immediate. We also introduce uniformly abelian-square rich words, that are infinite words such that for every n, every factor of length n contains a quadratic number of abelian squares.

As a first result, we prove that the famous Thue-Morse word is uniformly abelian-square rich. Then we look at the class of Sturmian words, that are aperiodic infinite words with the lowest factor complexity. In this case, we prove that if a Sturmian word is \(\beta \)-power free for some \(\beta \ge 2\) (that is, does not contain repetitions of order \(\beta \) or higher), then it is uniformly abelian-square rich.

2 Notation and Background

Let \(\varSigma =\{a_1,a_2,\ldots ,a_{\sigma }\}\) be an ordered \(\sigma \)-letter alphabet. Let \(\varSigma ^{*}\) stand for the free monoid generated by \(\varSigma \), whose elements are called words over \(\varSigma \). The length of a word w is denoted by |w|. The empty word, denoted by \(\varepsilon \), is the unique word of length zero and is the neutral element of \(\varSigma ^{*}\). We also define \(\varSigma ^{+}=\varSigma ^{*}\setminus \{\varepsilon \}\).

A prefix (resp. a suffix) of a word w is any word u such that \(w=uz\) (resp. \(w=zu\)) for some word z. A factor of w is a prefix of a suffix (or, equivalently, a suffix of a prefix) of w. The set of prefixes, suffixes and factors of the word w are denoted by \(\textit{Pref}(w)\), \(\textit{Suff}(w)\) and \(\textit{Fact}(w)\), respectively. From the definitions, we have that \(\varepsilon \) is a prefix, a suffix and a factor of any word.

For a word w and a letter \(a_i\in \varSigma \), we let \(|w|_{a_i}\) denote the number of occurrences of \(a_i\) in w. The Parikh vector (sometimes called composition vector) of a word w over \(\varSigma =\{a_1,a_2,\ldots ,a_{\sigma }\}\) is the vector \(P(w)=(|w|_{a_1},|w|_{a_2},\ldots ,|w|_{a_{\sigma }})\). An abelian k -power is a word of the form \(v_1v_2\cdots v_k\) where all the \(v_i\)’s have the same Parikh vector. An abelian 2-power is called an abelian square.

An infinite word w over \(\varSigma \) is an infinite sequence of letters from \(\varSigma \), that is, a function \(w:\mathbb {N}\mapsto \varSigma \). Given an infinite word w, the recurrence index \(R_w(n)\) of w is the least integer m (if any exists) such that every factor of w of length m contains all factors of w of length n. If the recurrence index is defined for every n, the infinite word w is called uniformly recurrent and the function \(R_w(n)\) the recurrence function of w. A uniformly recurrent word w is called linearly recurrent if the ratio \(R_w(n)/n\) is bounded. Given a linearly recurrent word w, the real number \(r_w=\limsup _{n\rightarrow \infty }R_w(n)/n\) is called the recurrence quotient of w.

The factor complexity function of an infinite word w is the integer function \(p_w(n)\) defined by \(p_w(n)=|\textit{Fact}(w)\cap \varSigma ^n|\). An infinite word w has linear complexity if \(p_w(n)=O(n).\)

A substitution over the alphabet \(\varSigma \) is a map \(\tau :\varSigma \mapsto \varSigma ^+\). Using the extension to words by concatenation, a substitution can be iterated. Note that for every substitution \(\tau \) and every \(n>0\), \(\tau ^n\) is again a substitution. Moreover, a substitution \(\tau \) over \(\varSigma \) can be naturally extended to a morphism from \(\varSigma ^*\) to \(\varSigma ^*\), since for every \(u,v\in \varSigma ^*\), one has \(\tau (uv)=\tau (u)\tau (v)\), provided that one defines \(\tau (\varepsilon )=\varepsilon \). A substitution \(\tau \) is k -uniform if there exists an integer \(k\ge 1\) such that for all \(a\in \varSigma \), \(|\tau (a)|=k\). We say that a substitution is uniform if it is k-uniform for some \(k\ge 1\). A substitution \(\tau \) is primitive if there exists an integer \(n\ge 1\) such that for every \(a\in \varSigma \), \(\tau ^n(a)\) contains every letter of \(\varSigma \) at least once. In this paper, we will only consider primitive substitutions such that \(\tau (a_1)=a_1v\) for some non-empty word v. These substitutions always have a fixed point, which is the infinite word \(w=\lim _{n\rightarrow \infty }\tau ^n(a_1)\). Moreover, this fixed point is linearly recurrent (see for example [7]) and therefore has linear complexity.

3 Abelian-square Rich Words

Kociumaka et al. [5] showed that a word of length n can contain a number of distinct abelian square factors that is quadratic in n. We give here a proof of this fact for the sake of completeness.

Proposition 1

A word of length n can contain \(\varTheta (n^{2})\) distinct abelian square factors.

Proof

Consider the word \(w_n=a^{n}ba^{n}ba^{n}\), of length \(3n+2\). For every \(0\le i,j\le n\) such that \(i+j+n\) is even, the factor \(a^{i}ba^{n}ba^{j}\) of w is an abelian square. Since the number of possible choices for the pair (ij) is quadratic in n, we are done. \(\quad \square \)

Motivated by the previous result, we wonder whether there exist infinite words such that all their factors contain a number of abelian squares that is quadratic in their length. But first, we relax this condition and consider words in which, for every sufficiently large n, a factor of length n contains, on average, a number of distinct abelian square factors that is quadratic in n.

Definition 1

An infinite word w is abelian-square rich if and only if there exists a positive constant C such that for every n sufficiently large one has

$$\begin{aligned} \frac{1}{p_w(n)}\sum _{v\in \textit{Fact}(w)\cap \varSigma ^n}{\{\#~abelian~square~factors~of~v\}}\ge C n^2. \end{aligned}$$

Notice that Christodoulakis et al. [6] proved that a binary word of length n contains \(\varTheta (n\sqrt{n})\) distinct abelian square factors on average, hence an infinite binary random word is almost surely not abelian-square rich.

Given a finite or infinite word w, we let \(\textit{ASF}_w(n)\) denote the number of abelian square factors of w of length n. Of course, \(\textit{ASF}_w(n)=0\) if n is odd, so this quantity is significant only for even values of n.

The following lemma is a consequence of the definition of linearly recurrent word.

Lemma 1

Let w be a linearly recurrent word. If there exists a constant C such that for every n sufficiently large one has \(\sum _{m\le n}\textit{ASF}_{w}(m)\ge Cn^2\), then w is abelian-square rich.

In an abelian-square rich word the average number of abelian squares in a factor is quadratic in the length of the factor. A stronger condition is that every factor contains a quadratic number of abelian squares. We thus introduce uniformly abelian-square rich words.

Definition 2

An infinite word w is uniformly abelian-square rich if and only if there exists a positive constant C such that for every n sufficiently large one has

$$\begin{aligned} \inf _{v\in \textit{Fact}(w)\cap \varSigma ^n}{\{{\#~abelian~square~factors~of~v}\}}\ge C n^2. \end{aligned}$$

Clearly, if a word is uniformly abelian-square rich, then it is also abelian-square rich, but the converse is not always true. However, in the case of linearly recurrent words, the two definitions are equivalent, as shown in the next lemma.

Lemma 2

If w is abelian-square rich and linearly recurrent, then it is uniformly abelian-square rich.

Proof

Since w is linearly recurrent, there exists a positive integer K such that every factor of w of length Kn contains all the factors of w of length n. Let v be a factor of w of length n containing the largest number of abelian squares among the factors of w of length n. Hence the number of abelian squares in v is at least the average number of abelian squares in a factor of w of length n. Since w is abelian square rich, the number of abelian squares in v is greater than or equal to \(Cn^2\), for a positive constant C and n sufficiently large. Since v is contained in any factor of w of length Kn, the number of abelian squares in any factor of w of length Kn is greater than or equal to \(Cn^2\), whence the statement follows. \(\quad \square \)

The rest of this section is devoted to prove that the Thue-Morse word and the Sturmian words that do not contain arbitrarily large repetitions are uniformly abelian-square rich.

3.1 The Thue-Morse Word

Let

$$\begin{aligned} t=011010011001011010010110\cdots \end{aligned}$$

be the Thue-Morse word, i.e., the fixed point of the uniform substitution \(\mu :0\mapsto 01,1\mapsto 10\). For every \(n\ge 4\), the factors of length n of t belong to two disjoint sets: those that start only at even positions in t, and those that start only at odd positions in t. This is a consequence of the fact that t is overlap-free, hence 0101 cannot be preceded by 1 nor followed by 0, and that 00 and 11 are not images of letters, so they cannot appear at even positions.

Let p(n) be the factor complexity function of t. It is known [8, Proposition 4.3], that for every \(n\ge 1\) one has \(p(2n)=p(n)+p(n+1)\) and \(p(2n+1)=2p(n+1)\).

The next lemma (proved in [9]) shows that the Thue-Morse word has the property that for every length there are at least one third of the factors that begin and end with the same letter, and at least one third of the factors that begin and end with different letters. We define \(f_{aa}(n)\) (resp. \(f_{ab}(n)\)) as the number of factors of t of length n that begin and end with the same letter (resp. with different letters).

Lemma 3

([9]). For every \(n\ge 2\), one has \(f_{aa}(n)\ge p(n)/3\) and \(f_{ab}(n)\ge p(n)/3\).

Since \(p(n)\ge 3(n-1)\) for every n [10, Corollary 4.5], we get the following result.

Corollary 1

For every \(n\ge 2\), one has \(f_{aa}(n)\ge n-1\) and \(f_{ab}(n)\ge n-1\).

Proposition 2

The Thue-Morse word t is uniformly abelian-square rich.

Proof

Let u be a factor of length \(n>1\) of t that begins and ends with the same letter. Since the image of any even-length word under \(\mu \) is an abelian square, we have that \(\mu ^2(u)\) is an abelian square factor of t of length 4n that begins and ends with the same letter. Moreover, the word obtained from \(\mu ^2(u)\) by removing the first and the last letter is an abelian square factor of t of length \(4n-2\). So, by Corollary 1, t contains at least \(n-1\) abelian square factors of length 4n and at least \(n-1\) abelian square factors of length \(4n-2\). This implies that for every even n the number of abelian square factors of t of length n is linear in n. Hence, for every n the number of abelian square factors of t of length at most n is quadratic in n. The statement then follows from Lemmas 1 and 2. \(\quad \square \)

3.2 Sturmian Words

In this section we fix the alphabet \(\varSigma =\{{\mathbf {\mathsf{{{a,b}}}}}\}\).

Recall that a (finite or infinite) word w over \(\varSigma \) is balanced if and only if for any uv factors of w of the same length, one has \(||u|_{{\mathbf {\mathsf{{{a}}}}}}-|v|_{{\mathbf {\mathsf{{{a}}}}}}|\le 1\).

We start with a simple lemma.

Lemma 4

Let w be a finite balanced word over \(\varSigma \). Then for any \(k>0\), \(P(w)=(0,0)\mod k\) if and only if w is an abelian k-power.

Proof

Let w be balanced and \(P(w)=(ks,kt)\), for a positive integer k and some \(s,t\ge 0\). Then we can write \(w=v_1v_2\cdots v_k\) where each \(v_i\) has length \(s+t\). Now, each \(v_i\) must have Parikh vector equal to (st) otherwise w would not be balanced, whence the only if part of the statement follows. The if part is straightforward. \(\quad \square \)

A binary infinite word is Sturmian if and only if it is balanced and aperiodic. Sturmian words are precisely the infinite words having \(n+1\) distinct factors of length n for every \(n\ge 0\). There is a lot of other equivalent definitions of Sturmian words. A classical reference on Sturmian words is [11, Chap. 2]. Let us recall here the definition of Sturmian words as codings of a rotation.

We fix the torus \(I=\mathbb {R}/\mathbb {Z}=[0,1)\). Given \(\alpha ,\beta \) in I, if \(\alpha > \beta \), we use the notation \([\alpha ,\beta )\) for the interval \([\alpha ,1)\cup [0,\beta )\). Recall that given a real number \(\alpha \), \(\lfloor \alpha \rfloor \) is the greatest integer smaller than or equal to \(\alpha \), \(\lceil \alpha \rceil \) is the smallest integer greater than or equal to \(\alpha \), and \(\{\alpha \}=\alpha -\lfloor \alpha \rfloor \) is the fractional part of \(\alpha \). Notice that \(\{-\alpha \}= 1-\{\alpha \}\).

Let \(\alpha \in I\) be irrational, and \(\rho \in I\). The Sturmian word \(s_{\alpha ,\rho }\) (resp. \(s'_{\alpha ,\rho }\)) of angle \(\alpha \) and initial point \(\rho \) is the infinite word \(s_{\alpha ,\rho }=a_{0}a_{1}a_{2}\cdots \) defined by

$$\begin{aligned} a_{n} = \left\{ \begin{array}{ll} {\mathbf {\mathsf{{{b}}}}} &{} \text {if } \{ \rho + n\alpha \}\in I_{{\mathbf {\mathsf{{{b}}}}}},\\ {\mathbf {\mathsf{{{a}}}}} &{} \text {if } \{ \rho + n\alpha \}\in I_{{\mathbf {\mathsf{{{a}}}}}}, \end{array} \right. \end{aligned}$$

where \(I_{{\mathbf {\mathsf{{{b}}}}}}=[0,1-\alpha )\) and \(I_{{\mathbf {\mathsf{{{a}}}}}}=[1-\alpha ,1)\) (resp. \(I_{{\mathbf {\mathsf{{{b}}}}}}=(0,1-\alpha ]\) and \(I_{{\mathbf {\mathsf{{{a}}}}}}=(1-\alpha ,1]\)).

In other words, take the unitary circle and consider a point initially in position \(\rho \). Then start rotating this point on the circle (clockwise) of an angle \(\alpha \), \(2\alpha \), \(3\alpha \), etc. For each rotation, take the letter \({\mathbf {\mathsf{{{a}}}}}\) or \({\mathbf {\mathsf{{{b}}}}}\) associated with the interval within which the point falls. The infinite sequence obtained in this way is the Sturmian word \(s_{\alpha ,\rho }\) (or \(s'_{\alpha ,\rho }\), depending on the choice of the two intervals). See Fig. 1 for an illustration.

Fig. 1.
figure 1

The rotation of angle \(\alpha =\varphi -1\approx 0.618\) and initial point \(\rho =\alpha \) generating the Fibonacci word \(F=s_{\varphi -1,\varphi -1}={\mathbf {\mathsf{{{abaababaabaabab}}}}}\cdots \).

For example, if \(\varphi =(1+\sqrt{5} )/2\approx 1.618\) is the golden ratio, the Sturmian word

$$\begin{aligned} F=s_{\varphi -1,\varphi -1}={\mathbf {\mathsf{{{abaababaabaababaababaabaababaabaab}}}}}\cdots \end{aligned}$$

is called the Fibonacci word:

A Sturmian word for which \(\rho =\alpha \), like the Fibonacci word, is called characteristic. Note that for every \(\alpha \) one has \(s_{\alpha ,0}={\mathbf {\mathsf{{{b}}}}}s_{\alpha ,\alpha }\) and \(s'_{\alpha ,0}={\mathbf {\mathsf{{{a}}}}}s_{\alpha ,\alpha }\).

An equivalent way to see the coding of a rotation consists in fixing the point and rotating the intervals. In this representation, the interval \(I_{{\mathbf {\mathsf{{{b}}}}}}=I_{{\mathbf {\mathsf{{{b}}}}}}^{0}\) is rotated at each step, so that after i rotations it is transformed into the interval \(I_{{\mathbf {\mathsf{{{b}}}}}}^{-i}=[\{-i\alpha \},\{-(i+1)\alpha \})\), while \(I_{{\mathbf {\mathsf{{{a}}}}}}^{-i}=I\setminus I_{{\mathbf {\mathsf{{{b}}}}}}^{-i}\).

This representation is convenient since one can read within it not only a Sturmian word but also any of its factors. More precisely, for every positive integer n, the factor of length n of \(s_{\alpha ,\rho }\) starting at position \(j\ge 0\) is determined by the value of \(\{\rho +j\alpha \}\) only. Indeed, for every j and i, we have:

$$\begin{aligned} a_{j+i} = \left\{ \begin{array}{lllll} {\mathbf {\mathsf{{{b}}}}} &{} \text { if}~ \{\rho + j\alpha \}\in I_{{\mathbf {\mathsf{{{b}}}}}}^{-i};\\ {\mathbf {\mathsf{{{a}}}}} &{} \text { if}~ \{\rho + j\alpha \}\in I_{{\mathbf {\mathsf{{{a}}}}}}^{-i}. \end{array} \right. \end{aligned}$$

As a consequence, we have that given a Sturmian word \(s_{\alpha ,\rho }\) and a positive integer n, the \(n+1\) different factors of \(s_{\alpha ,\rho }\) of length n are completely determined by the intervals \(I_{{\mathbf {\mathsf{{{b}}}}}}^{0}, I_{{\mathbf {\mathsf{{{b}}}}}}^{-1},\ldots , I_{{\mathbf {\mathsf{{{b}}}}}}^{-(n-1)}\), that is, only by the points \(\{-i\alpha \}\), \(0\le i< n\). In particular, they do not depend on \(\rho \), so that the set of factors of \(s_{\alpha ,\rho }\) is the same as the set of factors of \(s_{\alpha ,\rho '}\) for any \(\rho \) and \(\rho '\). Hence, from now on, we let \(s_{\alpha }\) denote any Sturmian word of angle \(\alpha \).

If we arrange the \(n+2\) points \(0,1,\{-\alpha \},\{-2\alpha \},\ldots ,\{-n \alpha \}\) in increasing order, we determine a partition of I in \(n+1\) subintervals, \(L_0(n),L_{1}(n),\ldots ,L_{n}(n)\). Each of these subintervals is in bijection with a different factor of length n of any Sturmian word of angle \(\alpha \) (see Fig. 2).

Fig. 2.
figure 2

The points 0, 1 and \(\{-\alpha \}\), \(\{-2\alpha \}\), \(\{-3\alpha \}\), \(\{-4\alpha \}\), \(\{-5\alpha \}\), \(\{-6\alpha \}\), arranged in increasing order, define the intervals \(L_{0}(6)\approx [0,0.146)\), \(L_{1}(6)\approx [0.146,0.292)\), \(L_{2}(6)\approx [0.292,0.382)\), \(L_{3}(6)\approx [0.382,0.528)\), \(L_{4}(6)\approx [0.528,0.764)\), \(L_{5}(6)\approx [0.764,0.910)\), \(L_{6}(6)\approx [0.910,1)\). Each interval is associated with one of the factors of length 6 of the Fibonacci word, respectively \({\mathbf {\mathsf{{{babaab}}}}},{\mathbf {\mathsf{{{baabab}}}}},{\mathbf {\mathsf{{{baabaa}}}}},{\mathbf {\mathsf{{{ababaa}}}}},{\mathbf {\mathsf{{{abaaba}}}}},{\mathbf {\mathsf{{{aababa}}}}},{\mathbf {\mathsf{{{aabaab}}}}}\).

Recall that a factor of length n of a Sturmian word \(s_{\alpha }\) has a Parikh vector equal either to \((\lfloor n\alpha \rfloor , n-\lfloor n\alpha \rfloor )\) (in which case it is called light) or to \((\lceil n\alpha \rceil , n-\lceil n\alpha \rceil ) \) (in which case it is called heavy). The following proposition relates the intervals \(L_{i}(n)\) to the Parikh vectors of the factors of length n (see [12, 13]).

Proposition 3

Let \(s_{\alpha }\) be a Sturmian word of angle \(\alpha \), and n a positive integer. Let \(t_{i}\) be the factor of length n associated with the interval \(L_{i}(n)\). Then \(t_{i}\) is heavy if \(L_{i}(n)\subset [\{-n\alpha \},1)\), while it is light if \(L_{i}(n)\subset [0,\{-n\alpha \})\).

Example 1

Let \(\alpha =\varphi -1\approx 0.618\) and \(n=6\). We have \(6\alpha \approx 3.708\), so that \(\{-6\alpha \}\approx 0.292\). The reader can see in Fig. 2 that the factors of length 6 corresponding to intervals above (resp. below) \(\{-6\alpha \}\approx 0.292\) all have Parikh vector (4, 2) (resp. (3, 3)). That is, the intervals \(L_{0}\) and \(L_{1}\) are associated with light factors (babaab, baabab), while the intervals \(L_{2}\) to \(L_{6}\) are associated with heavy factors (baabaa, ababaa, abaaba, aababa, aabaab).

Observe that, by Lemma 4, every factor of a Sturmian word having even length and containing an even number of \({\mathbf {\mathsf{{{a}}}}}\)’s (or, equivalently, of \({\mathbf {\mathsf{{{b}}}}}\)’s) is an abelian square. The following proposition relates the abelian square factors of a Sturmian word of angle \(\alpha \) with the arithmetic properties of \(\alpha \).

Proposition 4

Let \(s_{\alpha }\) be a Sturmian word of angle \(\alpha \), and n a positive even integer. Let \(t_{i}\) be the factor of length n associated with the interval \(L_{i}(n)\). Then \(t_{i}\) is an abelian square if and only if \(L_{i}(n)\subset [\{-n\alpha \},1)\) if \(\lfloor n \alpha \rfloor \) is even, or \(L_{i}(n)\subset [0,\{-n\alpha \})\) if \(\lfloor n \alpha \rfloor \) is odd.

Proof

By Proposition 3, \(t_i\) is heavy if and only if \(L_{i}(n)\subset [\{-n\alpha \},1)\), while it is light if and only if \(L_{i}(n)\subset [0,\{-n\alpha \})\). If \(\lfloor n \alpha \rfloor \) is even, then every light factor of length n contains an even number of \({\mathbf {\mathsf{{{a}}}}}\)’s and hence is an abelian square, while if \(\lfloor n \alpha \rfloor \) is odd, then every heavy factor of length n contains an even number of \({\mathbf {\mathsf{{{a}}}}}\)’s and hence is an abelian square, whence the statement follows. \(\quad \square \)

Recall that given a finite or infinite word w, \(\textit{ASF}_w(n)\) denotes the number of abelian square factors of w of length n.

Corollary 2

Let \(s_{\alpha }\) be a Sturmian word of angle \(\alpha \). For every positive even n, let \(I_{n}=\{\{-i \alpha \}\mid 1\le i \le n\}\). Then

$$\begin{aligned} \textit{ASF}_{s_{\alpha }}(n)= {\left\{ \begin{array}{ll} \# \{x\in I_{n} \mid x \le \{-n \alpha \}\} ~{ if }~\lfloor n \alpha \rfloor ~ is ~even; \\ \# \{x\in I_{n} \mid x \ge \{-n \alpha \}\} ~{ if ~\lfloor n \alpha \rfloor ~ is ~odd. }\\ \end{array}\right. } \end{aligned}$$

Example 2

The factors of length 6 of the Fibonacci word F are, lexicographically ordered: \({\mathbf {\mathsf{{{aabaab, aababa, abaaba, ababaa, baabaa}}}}}\) (heavy factors), \({\mathbf {\mathsf{{{baabab, babaab}}}}}\) (light factors). The light factors, whose number of \({\mathbf {\mathsf{{{a}}}}}\)’s is \(\lfloor 6 \alpha \rfloor =3\), are not abelian squares; the heavy factors, whose number of \({\mathbf {\mathsf{{{a}}}}}\)’s is \(\lceil 6 \alpha \rceil =4\), are all abelian squares.

We have \(I_{6}=\{0.382, 0.764, 0.146, 0.528, 0.910, 0.292\}\) (values are approximated) and \(6\alpha \simeq 3.708\), so \(\lfloor 6\alpha \rfloor \) is odd. Thus, there are 5 elements in \(I_{6}\) that are \(\ge \{-6 \alpha \}\), so by Corollary 2 there are 5 abelian square factors of length 6.

The factors of length 8 of the Fibonacci word are, lexicographically ordered: \({\mathbf {\mathsf{{{aabaabab}}}}}\), \({\mathbf {\mathsf{{{aababaab}}}}}\), \({\mathbf {\mathsf{{{abaabaab}}}}}\), \({\mathbf {\mathsf{{{abaababa}}}}}\), \({\mathbf {\mathsf{{{ababaaba}}}}}\), \({\mathbf {\mathsf{{{baabaaba}}}}}\), \({\mathbf {\mathsf{{{baababaa}}}}}\), \({\mathbf {\mathsf{{{babaabaa}}}}}\) (heavy factors), \({\mathbf {\mathsf{{{babaabab}}}}}\) (light factor). The light factor, whose number of \({\mathbf {\mathsf{{{a}}}}}\)’s is \(\lfloor 8 \alpha \rfloor =4\), is an abelian square; the heavy factors, whose number of \({\mathbf {\mathsf{{{a}}}}}\)’s is \(\lceil 8 \alpha \rceil =5\), are not abelian squares. We have \(I_{8}=\{0.382, 0.764, 0.146, 0.528, 0.910, 0.292, 0.674, 0.056\}\) (values are approximated) and \(8\alpha \simeq 4.944\), so \(\lfloor 8\alpha \rfloor \) is even. Thus, there is only one element in \(I_{8}\) that is \(\le \{8 \alpha \}\), so by Corollary 2 there is only one abelian square factor of length 8.

In Table 1 we report the first values of the sequence \(\textit{ASF}_F(n)\) for the Fibonacci word F.

Table 1. The first values of the sequence \(\textit{ASF}_{F}(n)\) of the number of abelian square factors of length n in the Fibonacci word \(F=s_{\varphi -1,\varphi -1}\).

Recall that every irrational number \(\alpha \) can be uniquely written as a (simple) continued fraction as follows:

$$\begin{aligned} \alpha =a_{0}+\frac{1}{a_{1}+\frac{1}{a_{2}+\ldots }} \end{aligned}$$
(1)

where \(a_{0}=\lfloor \alpha \rfloor \), and the infinite sequence \((a_{i})_{i\ge 0}\) is called the sequence of partial quotients of \(\alpha \). The continued fraction expansion of \(\alpha \) is usually denoted by its sequence of partial quotients as follows: \(\alpha =[a_{0};a_{1},a_{2},\ldots ]\), and each its finite truncation \([a_{0};a_{1},a_{2},\ldots ,a_{k}]\) is a rational number \(n_{k}/m_{k}\) called the kth convergent to \(\alpha \). We say that an irrational \(\alpha =[a_{0};a_{1},a_{2},\ldots ]\) has bounded partial quotients if and only if the sequence \((a_{i})_{i\ge 0}\) is bounded.

The development in continued fraction of \(\alpha \) is deeply related to the exponent of the factors of the Sturmian word \(s_{\alpha }\). Recall that an infinite word w is said to be \(\beta \)-power free, for some \(\beta \ge 2\), if for every factor v of w, the ratio between the length of v and its minimal period is smaller than \(\beta \). The second author [14] proved that a Sturmian word of angle \(\alpha \) is \(\beta \)-power free for some \(\beta \ge 2\) if and only if \(\alpha \) has bounded partial quotients.

Since the golden ratio \(\varphi \) is defined by the equation \(\varphi =1+1/\varphi \), we have from Eq. 1 that \(\varphi =[1;1,1,1,1,\ldots ]\) and therefore \(\varphi -1=[0;1,1,1,1,\ldots ]\), so the Fibonacci word is an example of \(\beta \)-power free Sturmian word (actually, it is \((2+\varphi )\)-power free [15]).

We are now proving that if \(\alpha \) has bounded partial quotients, then the Sturmian word \(s_{\alpha }\) is abelian-square rich. For this, we will use a result on the discrepancy of uniformly distributed modulo 1 sequences from [16]. To the best of our knowledge, this is the first application of this result to the theory of Sturmian words, and we think that the correspondence we are now showing might be useful for deriving other results on Sturmian words.

Let \(\omega =(x_n)_{n\ge 0}\) be a given sequence of real numbers. For a positive integer N and a subset E of the torus I, we define \(A(E;N;\omega )\) as the number of terms \(x_n\), \(0\le n\le N\), for which \(\{x_n\}\in E\). If there is no risk of confusion, we will write A(EN) instead of \(A(E;N;\omega )\).

Definition 3

The sequence \(\omega =(x_n)_{n\ge 0}\) of real numbers is said to be uniformly distributed modulo 1 if and only if for every pair ab of real numbers with \(0\le a<b\le 1\) we have

$$\begin{aligned} \lim _{N\rightarrow \infty } \frac{A([a,b);N;\omega )}{N}=b-a. \end{aligned}$$

Definition 4

Let \(x_0,x_1,\ldots , x_N\) be a finite sequence of real numbers. The number

$$\begin{aligned} D_N=D_N(x_0,x_1,\ldots , x_N)=\sup _{0\le \gamma <\delta \le 1}\left| \frac{A([\gamma ,\delta );N)}{N}-(\delta -\gamma )\right| \end{aligned}$$

is called the discrepancy of the given sequence. For an infinite sequence \(\omega \) of real numbers the discrepancy \(D_{N}(\omega )\) is the discrepancy of the initial segment formed by the first \(N+1\) terms of \(\omega \).

The two previous definitions are related by the following result.

Theorem 1

([16]). The sequence \(\omega \) is uniformly distributed modulo 1 if and only if \(\lim _{N\rightarrow \infty }D_N(\omega )=0\).

An important class of uniformly distributed modulo 1 sequences is given by the sequence \((n\alpha )_{n\ge 0}\) with \(\alpha \) a given irrational number and \(n\in \mathbb {N}\). The discrepancy of the sequence \((n\alpha )\) will depend on the finer arithmetical properties of \(\alpha \). In particular, we have the following theorem, stating that if \(\alpha \) has bounded partial quotients, then its discrepancy has the least order of magnitude possible.

Theorem 2

([16]). Suppose the irrational \(\alpha =[a_0;a_1,\ldots ]\) has partial quotients bounded by K. Then the discrepancy \(D_N(\omega )\) of \(\omega =(n\alpha )\) satisfies \(ND_N(\omega )=O(\log N)\). More exactly, we have

$$\begin{aligned} ND_N(\omega )\le 3+\left( \frac{1}{\log \varphi }+\frac{K}{\log (K+1)}\right) \log N. \end{aligned}$$
(2)

We are now using previous definitions and results to prove that \(\beta \)-power free Sturmian words are abelian-square rich.

Theorem 3

Let \(s_{\alpha }\) be a Sturmian word of angle \(\alpha \) such that \(\alpha \) has bounded partial quotients. Then there exists a positive constant C such that for every n sufficiently large one has \(\sum _{m\le n}\textit{ASF}_{s_{\alpha }}(m)\ge Cn^2\).

Proof

For every even n, let \(I'_{n}=\{\{i \alpha \}\mid 1\le i \le n\}\). By Corollary 2 and basic arithmetical properties of the fractional part, we have:

$$\begin{aligned} \textit{ASF}_{s_{\alpha }}(n)= {\left\{ \begin{array}{ll} \# \{x\in I'_{n} \mid x \ge \{n \alpha \}\} \text { if}\, \lfloor n \alpha \rfloor \,\text {is even;} \\ \# \{x\in I'_{n} \mid x \le \{n \alpha \}\} \text { if}\, \lfloor n \alpha \rfloor \,\text {is odd.}\\ \end{array}\right. } \end{aligned}$$

So:

$$\begin{aligned}&\sum _{m\le n}\textit{ASF}_{s_{\alpha }}(m) \end{aligned}$$
(3)
$$\begin{aligned}&\ge \sum _{m\le n} \# \{ \{i \alpha \}\mid \{i \alpha \}\le 1/2, i\le m, \text { and } \{m \alpha \}\le 1/2, \lfloor m\alpha \rfloor \text { even }\} \end{aligned}$$
(4)
$$\begin{aligned}&\ge \sum _{m\le n} \# \{ \{i \alpha /2\}\mid \{i \alpha /2\}\in [1/4,1/2), i\le m, \text { and } \{m \alpha /2\}\le 1/4 \} \end{aligned}$$
(5)
$$\begin{aligned}&\ge \sum _{n/2\le m\le n} \# \{ \{i \alpha /2\}\mid \{i \alpha /2\}\in [1/4,1/2), i\le n/2, \text { and } \{m \alpha /2\}\le 1/4 \} \end{aligned}$$
(6)
$$\begin{aligned}&= \# \{ \{i \alpha /2\}\mid \{i \alpha /2\}\in [1/4,1/2), i\le n/2\}\times \sum _{n/2\le m\le n} \{ m \mid \{m \alpha /2\}\le 1/4 \} \end{aligned}$$
(7)

where: (4) follows from (3) by Corollary 2; (5) follows from (4) because \(\{m \alpha /2\}\le 1/4\) implies \(\{m \alpha \}\le 1/2\) and \(\lfloor m\alpha \rfloor \) is even if and only if \(\{m \alpha /2\}\le 1/2\); (6) follows from (5) is obvious; finally (7) follows from (6) because the cardinality of the first set is independent from the sum.

Now, \(\alpha /2\) has bounded partial quotients (since \(\alpha \) has) and we can apply Theorem 2 to evaluate the two factors of (7). So we have:

$$\begin{aligned}&\# \{ \{i \alpha /2\}\mid \{i \alpha /2\}\in [1/4,1/2), i\le n/2\} \\&= A([1/4,1/2);n/2;(n\alpha /2)) \ \\&\ge (1/2-1/4)n/2-C_1\log n \\&= n/8-C_1\log n, \end{aligned}$$

for n sufficiently large and a positive constant \(C_1\). We also have:

$$\begin{aligned}&\sum _{n/2\le m\le n} \{ m \mid \{m \alpha /2\}\le 1/4 \} \\&=A([0,1/4);n;(n\alpha /2))-A([0,1/4);n/2;(n\alpha /2)) \\&\ge n/4-C_2\log n - n/8 - C_3\log n \\&= n/8 - C_4 \log n, \end{aligned}$$

for n sufficiently large and positive constants \(C_2,C_3,C_4\). The product of the two factors of (6) is therefore greater than a constant times \(n^2\), as required. \(\quad \square \)

The recurrence quotient \(r_{\alpha }\) of a Sturmian word of angle \(\alpha =[0;a_1,a_2,\ldots ]\) such that \(\alpha \) has bounded partial quotients verifies \(2+r_{\alpha }<\limsup a_i <3+r_{\alpha }\) [17, Proposition 5]. Moreover, Durand [18] proved that a Sturmian word of angle \(\alpha \) is linearly recurrent if and only if \(\alpha \) has bounded partial quotients. Thus, we have the following:

Corollary 3

Let \(s_{\alpha }\) be a Sturmian word of angle \(\alpha \). If \(s_{\alpha }\) is \(\beta \)-power free, then \(s_{\alpha }\) is uniformly abelian-square rich.

Proof

We known that \(s_{\alpha }\) is \(\beta \)-power free for some \(\beta \ge 2\) if and only if \(\alpha \) has bounded partial quotients if and only if \(s_{\alpha }\) is linearly recurrent. The statement then follows from Theorem 3 and Lemmas 1 and 2. \(\quad \square \)

4 Conclusions and Future Work

We proved that the Thue-Morse is uniformly abelian-square rich. We think that the technique we used for the proof can be generalized to some extent, and could be used, for example, to prove that a class of fixed points of uniform substitutions are uniformly abelian-square rich.

We also proved that Sturmian words that are \(\beta \)-power free for some \(\beta \ge 2\) are uniformly abelian-square rich. The proof we gave is based on a classical result on the discrepancy of the uniformly distributed modulo 1 sequence \((n\alpha )_{n\ge 0}\), where \(\alpha \) is the slope of the Sturmian word. To the best of our knowledge, this is the first application of this result to the theory of Sturmian words, and we think that the correspondence we have shown might be useful for deriving other results on Sturmian words.

The natural question that then arises is whether the hypothesis of power freeness is necessary for a Sturmian word being (uniformly) abelian-square rich. We leave open the question to determine whether \(s_{\alpha }\) is not uniformly abelian-square rich nor abelian-square rich in the case when \(\alpha \) has unbounded partial quotients.

We mostly investigated binary words in this paper. We conjecture that binary words have the largest number of abelian square factors. More precisely, we propose the following conjecture.

Conjecture 1

If a word of length n contains k many distinct abelian square factors, then there exists a binary word of length n containing at least k many distinct abelian square factors.

A slightly different point of view from the one we considered in this paper consists in identifying two abelian squares if they have the same Parikh vector. Two abelian squares are therefore called inequivalent if they have different Parikh vectors [19]. Sturmian words only have a linear number of inequivalent abelian squares. Nevertheless, a word of length n can contain \(\varTheta (n\sqrt{n})\) inequivalent abelian squares [20]. Computations support the following conjecture:

Conjecture 2

(see [5]). A word of length n contains \(O(n\sqrt{n})\) inequivalent abelian squares.