Long repetitive patterns in random sequences

Leonidas Guibas, Andrew OdlyzkoProbability 1980 · DOI

Abstract

In the study of random binary sequences, determining the expected length of the longest repetitive pattern is a foundational problem in probability and combinatorics. While previous research, notably by Erdős and Révész, established bounds for "head-runs" (consecutive sequences of a single symbol), significant gaps remained regarding general patterns and precise asymptotic behavior. Guibas and Odlyzko provide a definitive treatment of this problem, demonstrating that the longest run of a specific pattern in $n$ trials is approximately $\log_2 n$. Crucially, they reveal that this distribution does not settle into a simple limit but is instead characterized by a "jitter"—a tiny, quasi-periodic fluctuation.

Introduction

If one flips a fair coin 1,000 times, what is the longest consecutive string of "heads" one should expect to see? This question is more than a curiosity; it has implications for sequence analysis, cryptography, and the detection of non-randomness. Historically, mathematicians focused on runs of a single symbol. However, Guibas and Odlyzko generalized this inquiry to any non-periodic pattern (e.g., "010101...") and sought to answer three primary questions:

  1. What is the expected length of the longest run in a sequence of length $n$?
  2. Under what conditions will an infinite random sequence contain runs of a specific length?
  3. What is the average frequency of such runs?

By moving beyond traditional combinatorial counting, the authors closed the existing gap in the Erdős-Révész theorem and provided a high-precision characterization of these occurrences.

Methodology

The research employs a sophisticated blend of generating functions and complex analysis to derive sharp estimates for pattern occurrences.

String Correlation

A central innovation in this work is the use of a "correlation" measure between strings. This measure describes the internal overlap properties of a pattern. For instance, the pattern "101" can overlap with itself at the first and third positions (the suffix "1" matches the prefix "1"), whereas the pattern "110" has no such overlap. This autocorrelation significantly influences the probability of a pattern appearing in a finite sequence.

Analytical Techniques

The authors represent the probability of avoiding a set of patterns as a system of linear equations. By solving these using Cramer’s rule, they derive rational generating functions. To determine the behavior as the sequence length $n$ approaches infinity, they analyze the poles of these functions. Using Rouché's Theorem, they prove that a single "dominant" root determines the long-term probability, allowing for asymptotic estimations of unprecedented accuracy.

Key Insights

The "Jitter" (Quasi-periodicity)

The most striking discovery is that the expected length of the longest run does not converge to a smooth, simple function. Instead, it is expressed as $\log_2 n$ plus a periodic function of $\log n$. As the sequence length $n$ grows, the "extra" length fluctuates slightly rather than stabilizing. This periodic fluctuation in the mean is remarkably small—less than $1.6 \times 10^{-6}$—which explains why previous, less rigorous analyses failed to detect it.

Pattern Independence vs. Dependence

The authors distinguish between general existence and precise distribution. For broad questions regarding whether a run of a certain length exists (Theorem 1), the specific structure of the pattern is irrelevant; only its length matters. However, for calculating precise expected values and variances, the internal autocorrelation of the pattern becomes a critical variable.

B-runs vs. B*-runs

The paper introduces the concept of the $B^*$-run, a flexible definition of repetition that includes partial patterns (suffixes and prefixes). For example, "THTHT" is considered a $B^*$-run for the pattern "HT". This definition aligns more closely with human intuition regarding what constitutes a repetitive sequence compared to the stricter $B$-run definition.

Results and Discussion

Expected Value and Variance

The authors successfully derived a precise formula for the expected length of the longest $B$-run, $Z_n(B)$: $$E(Z_n(B)) = \log_2 n - 5/2 + \gamma(\log 2)^{-1} + \log_2(1 - 2^{-m}) + v_1(\log n + \dots) + o(1)$$ where $v_1$ represents the non-constant periodic jitter. Furthermore, they found that the variance of the longest run length is also quasi-periodic, fluctuating around a constant value of $c \approx 3.507$.

Theoretical Impact

This work provides a complete characterization of the critical values for $Z_n$, effectively closing the Erdős-Révész gap. It also provides formulas for the probability of having exactly $r$ non-overlapping occurrences of a pattern within a sequence of length $n$, offering a robust toolset for future probabilistic research.

Limitations and Future Directions

While the paper is a landmark in the field, it focuses primarily on binary (0/1) sequences and non-periodic base patterns (patterns that cannot be decomposed into repeating sub-units like "CC...C"). The authors suggest that extending these results to larger alphabets or unequal probabilities (biased coins) is straightforward, but they do not provide explicit formulas for those cases. Additionally, while the distribution of the longest head-run is known to be unimodal, the authors leave the question of whether this holds for all general $B$-runs and $B^*$-runs as an open problem for future investigation.

Summary updated

BibTeX
@inproceedings{guibas1980long,
  author = {Leonidas Guibas and Andrew Odlyzko},
  title = {{Long repetitive patterns in random sequences}},
  booktitle = {Probability},
  year = {1980},
  doi = {10.1007/bf00531434},
}

Loading related content...

Figure