Solution (source code)

= Solution
{c}

The <order of a group element> $g$ is the smallest positive integer $d$ with $g^d=e$. Such an integer exists in a <finite group>: two powers in $e,g,g^2,\ldots$ must agree, and cancellation gives a positive power equal to $e$.

By minimality, $e,g,\ldots,g^{d-1}$ are distinct. Every integer power of $g$ is one of them, by division of its exponent by $d$. They form the <cyclic subgroup>
$$
\langle g\rangle=\{e,g,\ldots,g^{d-1}\},\qquad|\langle g\rangle|=d.
$$
Applying <Lagrange's theorem> to this <subgroup> gives
$$
\boxed{o(g)=|\langle g\rangle|\mid|G|.}
$$