ON THE COMPLEXITY OF THE GENERALIZED FIBONACCI

. In this paper we undertake a general study of the complexity function of the generalized Fibonacci words which are generated by the morphism deﬁned by σ l,m ( a ) = a l b m and σ l,m ( a ) = a .


Introduction
The complexity function p, which counts the number of factors of given length in an infinite word, is a central notion in the field of combinatorics on words. It was introduced in 1975 by Ehrenfeucht et al. [8]. It allows one to measure diversity of patterns in an infinite word. It is often used in characterization of some words or families of words; for example eventually periodic words are the only words with bounded complexity function. For more details on this notion we refer the reader to [4,7].
Let σ be the morphism of the free monoid {a, b} * defined by σ(a) = ab and σ(b) = a. By iterating infinitely many times the morphism σ from a we obtain an infinite word called the Fibonacci word F = abaababaabaababaab · · · . This word was widely studied [2,9,11,12] and it is currently very famous for its numerous remarkable properties. The reader may consult [3] for more details on it. Its complexity function is well-known: for any n it admits exactly n + 1 factors of length n.
The generalized Fibonacci morphisms of the free monoid {a, b} * are the morphisms σ l, m defined by σ l, m (a) = a l b m and σ l, m (b) = a, for l ≥ 1 and m ≥ 2. By iterating infinitely many times the morphism σ l, m from a we obtain an infinite word F l, m called a generalized Fibonacci word (see [1], p. 336). In this paper we are interested in the complexity function of these words.
Precisely, we recall in Section 2 some basic definitions and notations. In Section 3 we describe weak and strong bispecial factors of F l, m . These are specific factors which play an important role in the study of the complexity function of an infinite word. Section 4 is devoted to the complexity function of F l, m . Then, we study asymptotic behavior of p(n) n (Sect. 5). We conclude the paper with some remarks and problems for further work.

Preliminaries
We recall here basic notions on words (see for instance [1,10] for more details). Let A = {a, b} be a fixed alphabet. A * , the set of finite words on A, is the free monoid generated by A; ε the empty word being the neutral element. For any u ∈ A * , |u| is called the length of u and represents the number of letters of u (|ε| = 0); and for each x ∈ A, |u| x is the number of occurrences of the letter x in u. A word u of length n written with a repeated single letter x is simply denoted u = x n , by extension x 0 = ε.
An infinite word is a sequence of letters of A. The set of infinite words over A is denoted A ∞ . A finite word v is a factor of a word u if there exist two words u 1 and u 2 on A such that u = u 1 vu 2 ; we say also that u contains v. The factor v is a prefix (resp. suffix) if u 1 (resp. u 2 ) is the empty word. We denote by pref (w) (resp. suf (w)) the set of prefixes (resp. suffixes) of w.
Let u be an infinite word on A, w a factor of u and x a letter of A. The set of factors of u of length n is denoted L n (u) and the set of all factors of u, L(u). The set L(u) is usually called the language of u. A letter x is a left (resp. right) extension of w in u if xw (resp. wx) is in L(u). The factor w is a left (resp. right) special factor of u if aw and bw (respectively wa and wb) appear in u. A factor of u which is both left special and right special in u is a bispecial factor.
The complexity function of an infinite word u is the map from N to N * defined by p u (n) = #L n (u), where #L n (u) designates the cardinality of the set of factors of u with length n. In all the sequel, the complexity function p u of a word u will be simply denoted p.
We call the function denoted s, and defined by s(n) = p(n + 1) − p(n), the first difference of the complexity function of a word u. So, we have the following formula On a binary alphabet the function s counts the number of right special factors of a given length in u. It happens that enumeration of some specific bispecial factors allows one to determine the function s (see [7]). We will come back to this in Sections 3 and 4.
A morphism f is a map from A * to itself such that f (uv) = f (u)f (v) for all u, v ∈ A * . It is said that an infinite word u is generated by a morphism f if there exists a letter x ∈ A such that the words x, f (x), f 2 (x), . . ., f n (x), . . . are longer and longer prefixes of u. Then we denote u = f ω (x).
Let u be an infinite word on A and v a factor of u. The Parikh vector of v is χ(v) = t (|v| a , |v| b ). We call the following matrix 3. Non-ordinary bispecial factors of F l, m Definition 3.1. Let u be an infinite word on A and v a bispecial factor of u.
-v is called strong bispecial if ava, avb, bva, bvb are factors of u.
-v is called weak bispecial if uniquely ava and bvb, or avb and bva, are factors of u.
-v is called ordinary bispecial if v is neither strong nor weak.
Definition 3.2. A factor of F l, m is said to be short if it does not contain any of the three words a l , b m and ba. A factor of F l, m which is not short will be called long.
Lemma 3.3. Let w be a long factor of F l, m . Then, there exists a unique triple of words (p, s, v) verifying p ∈ pref (a l b m−1 ), s ∈ suf (a l−1 b m ) and v ∈ L(F l, m ) such that w = sσ l, m (v)p and (v ∈ A * b =⇒ |p| ≥ l).
Proof. Existence. Let w be a long factor of F l, m . Then, either w is factor of σ l, m (x) where x ∈ A or w = sσ l, m (v)p where s is a proper suffix of σ l, m (x), p is a proper prefix of σ l, m (y) with x, y ∈ A and xvy ∈ L(F l, m ).
In this case one changes v and p as follows: We still have w = sσ l, m (v)p with p ∈ pref (a l b m−1 ) and |p| has increased. We repeat this process until to get • If v and v are not empty then v and v must end with the same letter. Then we change v to pref |v|−1 (v) and v to pref |v |−1 (v ). We repeat the process while v = ε and v = ε. • If v = ε and v = ε (or conversely) then we have sσ l, m (v) = s . Now, we have |s | < l + m. It follows that 0 < |σ l, m (v)| < l + m. Thus, we have v = b k and sa k = s . But s ends with b. That is impossible.
• Suppose p = p . Without loss generality let us assume that |p| > |p |. Then p can be written p = p p with p = ε. So, it follows that sσ l, m (v)p = s σ l, m (v ).
• If v is empty then sσ l, m (v)p = s . Now, we have |s | < l + m. So, v takes the form v = b k and we have sa k p = s . Since p = ε then s = ε and ends with b. Therefore, p also ends with b. So, we can write x be the last letter of p and of σ l, m (v ).
• If x = a, then the last letter of v is b and by ( ) we have |p | ≥ l. So, we have p = a l z and p = ya. That implies p p = ya l+1 z. That is impossible. Let us note that if a factor w is short then it is a factor of a l−1 b m−1 .
Lemma 3.4. 1. F l, m admits exactly one short and weak bispecial factor: b m−1 . 2. F l, m admits exactly one short and strong bispecial factor: ε.
Lemma 3.5. Let w be a factor of F l, m . The following assertions are equivalent: 1. w is a long bispecial factor of F l, m .

There exists a bispecial factor
Furthermore, v and w have the same type and |v| < |w|.
Proof. Let w be a long bispecial factor. Then wa, wb, aw, bw appear in F l, m . Futhermore with the synchronization Lemma there exists a unique triple of words (p, Then, asa and bsa appear in F l, m . If s = b j with 0 < j < m, then ab j a appears in F l, m , which is impossible. If s = a i b j with 0 < i < l, then ba i b m appears in F l, m , which is also impossible. Thus s = ε and we have w = σ l, m (v)p.
Let us now show that p = a l . Suppose |p| > l.
The inequality |v| < |w| is obvious. Conversely, assume that v is a bispecial factor of F l, m and that w =σ l, m (v). As the words av, bv, va and vb occur in F l, m , it follows that a l b m w, aw, wb m a l and wa occur in F l, m . So, w is a bispecial factor of F l, m , which is long since it contains a l . Finally, if w =σ l, m (v), then # (x, y) ∈ A 2 : xwy ∈ L(F l, m ) = # (x , y ) ∈ A 2 : x vy ∈ L(F l, m ) .
So, v and w have the same type.
As a consequence, we have: 1. The weak bispecial factors of F l, m are given by the sequence (y n ) defined by y 1 = b m−1 and y n+1 = σ l, m (y n ), for n ≥ 1. 2. The strong bispecial factors of F l, m are given by the sequence (x n ) defined by x 0 = ε and x n+1 =σ l, m (x n ), for n ≥ 0.

Complexity of F l, m
In order to understand the complexity function of F l, m , we begin this section with a review of some properties of sequences of weak bispecial and strong bispecial factors of F l, m . Definition 4.1. Let v, w ∈ A * and χ (v) , χ (w) be their Parikh vectors. One says that χ (v) is less than χ (w) and one writes Note that this define a partial order on words. Let v, w, v , w be four finite words such that v =σ l, m (v) and w =σ l, m (w). Then, Proof. On the one hand, we have |v | a = l |v| a + |v| b + l and |w | a = l |w| a + |w| b + l; so |v | a < |w | a . On the other hand, we have |v | b = m |v| a and |w | b = m |w| a ; so |v | b ≤ |w | b .
The following Lemma describes the function s. • s(n) = 1 for n = 0. • if n ∈ N * , take k the largest integer such that n > |x k |.
Suppose n ≥ |x 1 |. Take k the largest integer such that n > |x k |. Then, it follows: The proof is complete.

Proof. By Lemma 4.4, we have
It follows that: Lemma 4.6. We have the following equivalences.
Proof. Consider the sequence (V k ) k≥1 defined by V k = χ (x k ) − χ (y k ). We have: is the incidence matrix of σ l, m . The eigenvalues of the matrix A, being the roots of X 2 − lX − m, are Observe that λ 1 > l ≥ 1 and −λ 1 < λ 2 < 0. Moreover we have Thus, with α 1 and α 2 verifying the following system of equations We have Since |λ 2 | < λ 1 , then |x k | − |y k | has the same sign as α 1 for k sufficiently large.
By summation, it follows that n−1

Asymptotic behavior of p (n) n
Before the statement of the main result we need some technical lemmas.

Concluding remarks and further work
It results from Theorem 4.7 that: if m ∈ [2, 2l 2 + 1], then 1 ≤ lim inf p (n) n ≤ lim sup p (n) n ≤ 2; (6.1) if m > 2l 2 + 1, then 2 ≤ lim inf p (n) n ≤ lim sup p (n) n ≤ 3. (6.2) By Theorem 5.3 one observes that for F l, m , the values of lim inf p(n) n and lim sup p(n) n are strictly dependent with those of the parameters l and m. Indeed, we check that (6.1) and (6.2) become if m ∈ [2, 2l 2 + 1], then 1 < lim inf p (n) n < lim sup p (n) n < 2; (6.3) if m > 2l 2 + 1, then 2 < lim inf p (n) n < lim sup p (n) n < 3. (6.4) For l ≥ 1, m ≥ 2, let us write α l, m = lim inf p(n) n and β l, m = lim sup p(n) n . In (6.1) the value 1 is reached when m = 1. In this case F l, m is Sturmian and we have excluded it by taking m ≥ 2. The values 2 and 3 are never reached, but we can prove that they are accumulation points for α l, m and β l, m .
In further work, it will be interesting to describe the region covered by the cloud of points (α l, m , β l, m ) in the first quadrant of the plane.
Another problem is to undertake a similar study in the case of S-adic words where morphisms are all generalized Fibonacci morphisms.