A non-empty word is a border of the word if and is both a prefix and a suffix of . A border of the word is the maximal border of if for every border of we have that . A word with the border is closed if has exactly two occurrences of . It follows that occurs only as a prefix and as a suffix of . A word is privileged if or if contains a privileged border that appears exactly twice in . Obviously privileged words are a subset of closed words.
The properties of closed and privileged words have been studied in recent years [KeLeSa2013], [Pelto2013], [ScSh16]. One of the questions that has been investigated is the enumeration of privileged words. In [Nicholson2018_priviligedwords], it was proved that there are constants and such that for all , there are at least privileged words of length . This improves the lower bound for the number of privileged words from [FoJaPeSha2016]. Since every privileged word is a closed word, the result from [Nicholson2018_priviligedwords] forms also a lower bound for the number of closed words.
Concerning an upper bound for the number of privileged words we have found only the following open problem [Pelto2016]: “Give a nontrivial upper bound for ”, where denotes the number of privileged words of length . Also in [Pelto2016], the author presents an idea how to improve the lower bound from [Nicholson2018_priviligedwords]. On the other hand, in [Pelto2016], there is no explicit suggestion how to approach the problem of determining the upper bound.
In the current article we construct an upper bound for the number of closed words of length . Since the privileged words are a subset of closed words, we present also a response to the open problem from [Pelto2016].
We explain in outline our proof. Let be an alphabet with letters, let denote the set of all words of length , and let . It is known that . Let denote the number of words of length that do not contain the factor . Let be the maximal value of for all of length ; formally
Let denote the set of all closed words of length and let denote the set of all closed words of length having a maximal border of length . Let and .
Obviously and , where . We show that if then and if then ; see Lemma 2.5. It follows that
Let denote the set of positive integers. Let . Let denote the set of all functions such that if and only if and for all . We apply the function , because for some small .
The key observation in our article is that the number of words of length that do not contain some “short" factor of length has the same growth rate as the number of words of length . Formally said, for each there is a positive real constant such that ; see Theorem 2.3. This observation allows us to show that there are real positive constants such that
In consequence we may count only closed words having a maximal border longer than in order to find an upper bound for . Applying that for , we derive from (1) and (2) our result for the number of closed words.
2 Upper bound for the number of closed words
We present an upper bound for the number of words of length that avoid some factor of length ; it means an upper bound for .
Given , let be a set of words , where , , for all , and It follows that and thus . Obviously
Note that . It is clear that the set of words of length not containing the factor is a subset of . The lemma follows. ∎
For the proof of Theorem 2.3 we need the following limit.
We have that
Let denote the set of positive real numbers.
Let . The following theorem states that the number of words of length avoiding some given "short" factor (of length shorter than ) has the same growth rate as the number of all words of length .
If then there is a constant such that for all we have that
From Lemma 2.1 we have that
Realize that .
Let . We present Theorem 2.3 in a slightly different manner that will be more useful for us in the following.
If , and then there is a constant such that for all we have that
It is easy to verify that , since the number of words of length avoiding some factor of length is bigger or equal to the number of words of length avoiding some factor of length .
Obviously . In consequence we have that .
The corollary follows from Theorem 2.3. This completes the proof. ∎
We show an upper bound for for the cases where and .
If then .
If then .
If , , and then there is obviously at most one word with having a prefix and a suffix ; the prefix and the suffix would overlap with each other. If such exists then the first half of uniquely determines the second half of . If follows that .
Let denote the set of all factors of . If then let
If then . It is easy to see that
This completes the proof. ∎
Let be a real constant and . Again we use the function to guarantee that for small .
The function defines the maximal length of a “short” border of a closed word. In the proof of Theorem 2.9 the closed words from will be enumerated differently for and for .
The next auxiliary lemma shows an upper bound for , that we will use in the proof of Proposition 2.8.
There is a constant such that for all we have that
We have that
This implies that
The lemma follows. ∎
The next proposition shows an upper bound for the number of closed words of length having a maximal border of length .
There is a constant such that
Since we have that
Corollary 2.4 implies that for some constant . It follows that
where is some real positive constant.
We show an upper bound for .
There is a constant such that
Note that the some of the constants , that we used in our results and in particular in Theorem 2.9, depend on .
The author acknowledges support by the Czech Science Foundation grant GAČR 13-03538S and by the Grant Agency of the Czech Technical University in Prague, grant No. SGS14/205/OHK4/3T/14.