  The Games-Chan algorithm finds the minimal period of a periodic binary
sequence of period $2^n$, in $n$ iterations. We generalise this to periodic
$q$-ary sequences (where $q$ is a prime power) using generating functions and
polynomials and apply this to find the multiplicity of $x-1$ in a $q$-ary
polynomial $f$ in $\log_{\,q}\deg(f)$ iterations.
