Given a word $w$, what is the maximum possible number of appearances of $w$ reading contiguously along any of the directions in $\{-1, 0, 1\}^d \setminus \{\mathbf{0}\}$ in a large $d$-dimensional grid (as in a word search)? Patchell and Spiro first posed a version of this question, which Alon and Kravitz completely answered for a large class of ``well-behaved" words, including those with no repeated letters. We study the general case, which exhibits greater variety and is often more complicated (even for $d=1$). We also discuss some connections to other problems in combinatorics, including the storied $n$-queens problem.
This paper investigates the maximum number of occurrences of a given word w when read consecutively along "word search" directions (i.e., direction vectors in {-1,0,1}^d{0}) in a d-dimensional grid. The problem was first proposed by Patchell and Spiro, and completely resolved for words without repeated letters by Alon and Kravitz. This paper studies the general case containing repeated letters, revealing richer structure and complexity (even in d=1), and uncovering deep connections with classical combinatorial problems such as the n-queens problem.
Given a word w and dimension d, how can one arrange letters in an n₁×n₂×...×n_d d-dimensional toroidal grid (with each coordinate modulo n_i) to maximize the number of occurrences of w? Here "occurrence" refers to reading w consecutively along one of the 3^d-1 search directions.
Complete Solution for One Dimension (Theorem 1.2): Provides a closed form for the concentration C₁(w) of any word in one dimension and classifies all extremal grids
Dimension Bounds (Proposition 1.3): Proves for any word w and dimension d:
3d−1C1(w)≤Cd(w)≤23d−1C1(w)
Characterization of d-Stackability (Theorem 1.4):
Parity words (letters not appearing simultaneously at odd and even positions) are d-stackable in all dimensions
Letter repetition preserves d-stackability
Complete characterization of 2-stackability for 4-letter words
Proves AB^(ℓ-1) (ℓ>3) is not 2-stackable
Bounds on d-Tileability (Theorem 1.5):
Words of length ℓ cannot be d-tileable when d≥8log₂ℓ+47
When all prime factors of ℓ are ≥2^d, AB^(ℓ-1) is d-tileable
Methodological Contributions: Develops four major techniques
Transforms the problem into a set addition problem. For direction v, define:
Sv={p∈G:(p,v) is an occurrence of w}
Key observation:
(Su−Sv)∩Iu,v=∅
where Iu,v={iv−ju:0≤i,j<len(w),wi=wj}
This transforms the counting problem into maximizing ∑v∣Sv∣/∣G∣ under additive constraints.
Complete Solution for One Dimension:
Define three parameters:
c_left: length of longest palindromic prefix
c_right: length of longest palindromic suffix
c_repeat: length of longest substring that is both a proper prefix and proper suffix
Theorem 3.1: For a word w of length ℓ:
If w is not palindromic: C1(w)=max(ℓ−crepeat1,ℓ−2cleft+cright1)
If w is palindromic: C1(w)=ℓ−crepeat2
Two Types of Extremal Constructions:
Construction 1 (overlapping same direction): When c_repeat is large, repeat w=vs (s is the c_repeat-length repeated substring) by overlapping the v part
Construction 2 (alternating directions): When c_left+c_right is large, alternate reading w forward and backward, overlapping palindromic parts
Lemma 7.1: For f:(Z/3Z)^d→0,1, α=𝔼f:
Ex,yf(x)(1−f(x+y))(1−f(x+2y))≤23α(1−α)2
Proof technique:
Expand expectation in terms of Fourier coefficients
Use properties of ω=e^(2πi/3)
Apply Lemma 7.2: If ℜ(z),ℜ(ωz),ℜ(ω²z)≤β, then ℜ(z³)≤β³
Application 2: Dimension bounds for d-tileability
Core Strategy (Theorem 1.5a proof):
Construct near-extremal grid Θ (Lemma 7.3)
Apply stability result (Theorem 3.2): Near-extremal search lines have nearly identical letter distributions
Fourier analysis contradiction (Lemma 7.4): In (Z/nZ)^d (n<2^d), impossible for all search lines to have identical letter distributions
Lemma 7.4: In grids of shape (Z/nZ)^d (n<2^d), if letter A occupies proportion α, then there exist two search lines whose A counts differ by at least:
3d/2min(α,1−α)n
Proof uses second moment method and Fourier transform.
1 N. Alon and N. Kravitz. Cats in cubes. Electron. J. Combin., 31(3):Paper No. 3.29, 2024.
Direct predecessor of this paper, resolves non-repeated-letter case
14 G. Patchell and S. Spiro. The maximum number of appearances of a word in a grid. Amer. Math. Monthly, 129(5):415–434, 2022.
Original problem formulation
8 R. Greenfeld and T. Tao. A counterexample to the periodic tiling conjecture. Ann. of Math., 200(1):301–363, 2024.
Important counterexample related to Problem 2.5
4 J. Bell and B. Stevens. A survey of known results and research areas for n-queens. Discrete Math., 309(1):1–31, 2009.
Comprehensive n-queens survey
16 A. A. Razborov. Flag algebras. J. Symbolic Logic, 72(4):1239–1282, 2007.
Powerful tool in extremal combinatorics, related to this paper's linear programming method
18 T. Tao. Higher order Fourier analysis. Graduate Studies in Mathematics, vol. 142, AMS, 2012.
Standard reference for higher-order Fourier analysis, discussed as potential application
Overall Assessment: This is an excellent combinatorics paper that systematically investigates a natural and profound problem. Through developing multiple complementary techniques, the authors achieve substantial progress, particularly completely solving the one-dimensional case and partially solving two-dimensional short words. The paper reveals unexpected connections with classical n-queens problems and poses rich open questions. Main limitations stem from computational complexity restricting method scalability and limited understanding of long words and high dimensions. Nevertheless, this paper establishes solid foundations for the field, with methods and results likely to inspire future research.