TAOCP 7.2.2.1 Exercise 91

Fix a positive integer $W$.

Section 7.2.2.1: Dancing Links

Exercise 91. [40] [40] For given $W$, find the largest $p$ such that $\text{WORDS}(W)$ supports a word stair of period $p$. [There are two questions for each $W$, examining stairs to the left, right.]

Verified: no
Solve time: 1m12s


Setup

Fix a positive integer $W$. Let $\text{WORDS}(W)$ denote the finite set of available words o