1 Introduction
Regularities and repetitions have been studied extensively in the field of combinatorics on words. One of the early results in the area is Thue’s observation that while every sufficiently long binary word contains a square, in contrast there are arbitrarily long words over a ternary alphabet avoiding squares [1, 9, 10]. In this context, avoidance of a certain set of words means that none of the words of this set appears as a factor. Thue’s results show that avoidance of powers depends on the alphabet size. In this note, we focus solely on binary words. The study of avoidance of patterns has been extended to powers, i.e., nonempty words of the form , and other variants of the problem; see e.g., [3, 4, 6].
In [5], Fici et al. introduced the notion of antipowers. Whereas a power is a sequence of adjacent blocks that are all the same, an antipower is a sequence of consecutive adjacent blocks of the same length that are pairwise different. Formally, a antipower is a word of the form such that and the factors are pairwise distinct, i.e., .
Fici et al. also suggested investigating the simultaneous avoidance of powers and antipowers, which is the main topic of this work. They defined to be the shortest length such that every binary word of length contains either a power or an antipower as a factor. It is known that is bounded polynomially in and [5]. The available numerical evidence (see [7]) suggests that for each fixed we have
for some function . We first prove the lower bound for . Then we show that this bound is tight for .
This paper is based, in part, on the master’s thesis of the second author [7].
2 A lower bound on
To prove the desired lower bound, we give an explicit family of binary words and use combinatorial arguments to show that avoids powers and antipowers.
Theorem 1.
Let and . Define . Then , but has no powers, nor antipowers.
Proof.
First, we argue that contains no power . Suppose it does. Clearly, does not contain or , so . However, every factor of length of contains the word , and so contains . Thus, must also contain the factor and must contain at least twice. If two occurrences of appear at a distance of less than in , then cannot be a factor of . Therefore, must have length at least . But then has length at least , contradicting our assumption.
Next, we argue that contains no antipower. First, observe that in any sequence of nonoverlapping blocks in , at most blocks can contain as a factor. All remaining blocks belong to the set . Since the set only contains two words of each length, this implies that any sequence of consecutive blocks of the same length contains at least two identical blocks. We conclude that contains no antipower. ∎
This theorem immediately yields a lower bound that matches our conjectured upper bound up to an additive term that only depends on .
Corollary 2.
for all .
Remark 3.
In particular we get for . Computations show that equality holds for . We conjecture that equality holds for all .
3 Binary words avoiding antipowers
For a language , we let denote the (transitive) closure of under bitwise complementation and reversal. It consists of all length words from , all bitwise complements of length words from , all reversed length words from and all bitwise complements of reversed length words from . It is easy to see that if a binary word contains a power, then both its bitwise complement and its reversal also contain a power. The same argument applies to antipowers. Together with the fact that bitwise complementation and reversal are involutions, this implies that avoids powers (resp., antipowers) if and only if avoids powers (resp., antipowers).
The definition of allows us to give a simple description of all binary words avoiding antipowers. Before giving the general result, we only characterize words avoiding antipowers whose lengths are multiples of .
Theorem 4.
Let be divisible by . Let be the set of binary words of length avoiding antipowers. Then .
Proof.
Note that it is easy to verify the claim for by enumerating all words of this length. For larger values, we prove the claim by induction.
Let with . By induction, all factors of length avoid antipowers. Moreover, it is easy to see that when splitting any word from into three blocks of equal length, at least two of these blocks coincide. Therefore, all words in avoid antipowers. It remains to show that if avoids antipowers, then . Since avoidance of antipowers is invariant under bitwise complementation, we may assume that . Moreover, if , we may assume that starts with a .
We factorize with . By induction, and belong to . Since contains at least as many zeroes as ones, and starts with a if the number of zeroes equals the number of ones, this implies that .
If , then , otherwise either or . This implies , thus . Similarly, if , then and .
The remaining case is . Since at least two of the factors in the unique factorization with must coincide, either or . Avoidance of antipowers is invariant under reversal, so we may assume . Since implies that belongs to and this set is closed under prepending zeroes, we obtain that has the desired form. This concludes the proof. ∎
We now extend this characterization to words whose lengths are not divisible by .
Corollary 5.
Let be the set of binary words of length avoiding antipowers. Let . Then

,

and

.
In particular, there exist (resp., , ) binary words of length (resp., , ) avoiding antipowers.
Proof.
For words of length , it suffices to investigate their two factors of length and apply the previous theorem. Similarly, for words of length , we investigate all three factors of length .
We now fix some and count the number of words of length . Words from and coincide with their reverses and words from coincide with the bitwise complements of their reverses. Thus, contains exactly four words. The set contains words: all words of the form or with and . The sets and contain exactly one word of length ; and the reverse, the bitwise complement and the bitwise complement of the reverse of each of these words are distinct from one another. Therefore, contains eight words. Together, this shows that .
Since every word from coincides with its reverse but not with its bitweise complement, we obtain . Moreover, every word from does not coincide with its reverse, its bitwise complement or the bitwise complement of its reverse, so . ∎
Remark 6.
Corollary 5 shows that there are only linearly many binary words avoiding antipowers. In contrast, the construction given in [5, Prop. 12] can be adapted to show that , the number of length binary words avoiding antipowers, grows faster than any polynomial in . This can be proved as follows: let be any infinite sequence of integers satisfying and . For define the characteristic sequence
and . Then it is not hard to show, using the ideas in [5, Prop. 12], that every length prefix of every avoids antipowers. Let be the number of length prefixes of words of this form; then . It is not hard to see that for . Then, according to [2], we have .
To extend Corollary 5 to infinite words, it suffices to determine all words whose factors belong to the set defined in Theorem 4.
Corollary 7.
The only infinite binary words avoiding antipowers are of the form , , , , for , and their binary complements.
Using Corollary 5, we can prove a tight upper bound for .
Theorem 8.
for all .
Proof.
The lower bound follows from Corollary 2. Thus, it suffices to show that every binary word of length contains either a power or a antipower.
Let be a word that avoids antipowers. By closure of the sets of powers and antipowers under bitwise complementation, we may assume that . If , then is a factor of . If , then by Corollary 5. Moreover, if , then for some with and . In any case, contains a power. ∎
Our results above only hold for words of length at least . With a slightly more technical proof or by computing all words of length less than avoiding antipowers, it can be shown that the characterization given in Corollary 5 can be extended to all words of length at least . Moreover, it is easy to see that all words of length avoid antipowers. For the remaining lengths, the following table lists all words avoiding antipowers up to bitwise complementation and reversal.
Words of length avoiding antipowers, up to complementation and reversal  

6  , , , , , , , , , , , , 
7  , , , , , , , , , , , , , , , , 
8  , , , , , , , , , , , , , , , , , , , , , , , , , 
9  , , , , , , , , , , , , , , 
10  , , , , , , , , , , , , , , 
11  , , , , , , , , , , , , , , , , , , , 
4 A lower bound for
While the lower bound in Corollary 2 is tight up to an additive constant that only depends on , better bounds are possible for specific values of . One such example is given below.
Theorem 9.
Let . Then . If, additionally, , then .
Proof.
The following table gives, for each , a word that contains no power and no antipower. The construction depends on the equivalence class of . Therefore, the table contains separate rows for each where .
0  

1, 3, 7, 9  
2, 4, 8  
5  
6 
To see that none of these words contains a power, we can use exactly the same argument as in the proof of Theorem 1.
To prove avoidance of antipowers, we also resort to ideas from the proof of Theorem 1 but the arguments are slightly more technical. Let us first investigate the case , i.e., words of the form
By contradiction, assume that such a word contains a factor of the form where all the have the same lengths and are pairwise distinct. In the following, we say that a binary word is alternating if (and only if) it belongs to the set .
Note that since the patterns in appear at even distances and since and have even lengths, only one of the three words can be alternating; otherwise, two of these words would coincide. Similarly, either or must not be alternating. On the contrary, since , either the prefix or the suffix of does not overlap with the occurrence of . Considering all possible factorizations of into five consecutive blocks of equal lengths, it is easy to see that at least two of the words must be alternating. Together with the previous observation, this means that exactly one of the words and exactly of the words is alternating. We now analyze the six possible cases.
First, suppose that and are alternating. This implies that the have length at most because every factor of length of contains as a prefix or as a suffix or as a factor. But then, it is easy to see that at either or are alternating as well, a contradiction. A similar argument applies whenever two adjacent blocks are alternating. The remaining cases are that are alternating or are alternating. Since they are symmetrical, it suffices to investigate the first case. Considering the possible positions of and in , it becomes obvious that then, either or has to be alternating as well, again contradicting the observation above.
This concludes the correctness proof of the construction. Similar arguments can be used to prove avoidance of antipowers for the lower bound witnesses given for . ∎
5 Open problems
The exact asymptotic behavior of remains open. To the best of our knowledge, the best general upper bound known to date is linear in and cubic in . However, it is consistent with this result and our conjecture that the asymptotic behavior is of the form for some function . While still linear in and cubic in , proving an upper bound of the form for some constant and some function would be a big step towards proving our conjecture.
It would also be interesting to investigate the growth of more carefully. Can our lower bound be improved to show that is unbounded? Can we prove a subcubic upper bound? More numerical evidence might help establish a conjecture on the growth rate of .
References
 [1] J. Berstel. Axel Thue’s Papers on Repetitions in Words: a Translation. Number 20 in Publications du Laboratoire de Combinatoire et d’Informatique Mathématique. Université du Québec à Montréal, February 1995.
 [2] N. G. de Bruijn. On Mahler’s partition problem. Proc. Kon. Ned. Akad. v. Wet. Amsterdam 51 (1948), 659–669.
 [3] F. M. Dekking. On repetitions of blocks in binary sequences. Journal of Combinatorial Theory, Series A 20(3) (1976), 292–299.
 [4] R. C. Entringer, D. E. Jackson, and J. A. Schatz. On nonrepetitive sequences. Journal of Combinatorial Theory, Series A 16(2) (1974), 159–164.
 [5] Gabriele Fici, Antonio Restivo, Manuel Silva, and Luca Q. Zamboni. Antipowers in infinite words. Journal of Combinatorial Theory, Series A 157 (2018), 109–119.
 [6] A. S. Fraenkel and J. Simpson. How many squares must a binary sequence contain? Electronic J. Combinatorics 2 (1994), #R2.
 [7] Samin Riasat. Powers and antipowers in binary words. Master’s thesis, School of Computer Science, University of Waterloo, 2019. Available at https://uwspace.uwaterloo.ca/handle/10012/14974.
 [8] N. J. A. Sloane et al. The OnLine Encyclopedia of Integer Sequences. Available electronically at https://oeis.org, 2019.
 [9] A. Thue. Über unendliche Zeichenreihen. Norske vid. Selsk. Skr. Mat. Nat. Kl. 7 (1906), 1–22. Reprinted in Selected Mathematical Papers of Axel Thue, T. Nagell, editor, Universitetsforlaget, Oslo, 1977, pp. 139–158.
 [10] A. Thue. Über die gegenseitige Lage gleicher Teile gewisser Zeichenreihen. Norske vid. Selsk. Skr. Mat. Nat. Kl. 1 (1912), 1–67. Reprinted in Selected Mathematical Papers of Axel Thue, T. Nagell, editor, Universitetsforlaget, Oslo, 1977, pp. 413–478.