The problem of computing periods in words, or finite sequences of symbols from a finite alphabet, has important applications in several areas including data compression, string searching and pattern matching algorithms. The notion of period of a word is central in combinatorics on words. There are many fundamental results on periods of words. Among them is the well known and basic periodicity result of Fine and Wilf which intuitively determines how far two periodic events have to match in order to guarantee a common period. More precisely, any word with length at least having periods p and q has also period the greatest common divisor of p and q, . Moreover, the bound is optimal since counterexamples can be provided for words of smaller length.
Partial words, or finite sequences that may contain a number of “do not know” symbols or holes, appear in natural ways in several areas of current interest such as molecular biology, data communication, DNA computing, etc. Any long enough partial word with h holes and having periods has also period . In this paper, we give closed formulas for the optimal bounds in the case where and also in the case where q is large. In addition, we give upper bounds when q is small and or 7. No closed formulas for were known except for the cases where or 2. Our proofs are based on connectivity in graphs associated with partial words. A World Wide Web server interface has been established at www.uncg.edu/mat/research/finewilf3 for automated use of a program which given a number of holes h and two periods p and q, computes the optimal bound and an optimal word for that bound (a partial word u with h holes of length is optimal if p and q are periods of u but is not a period of u).
This material is based upon work supported by the National Science Foundation under Grant No. DMS-0452020. We thank the referee of a preliminary version of this paper for his/her very valuable comments and suggestions.