Solution (source code)

= Solution

An integer $b$ is a <primitive root> modulo $n$ when it is coprime to $n$ and its residue class generates the <multiplicative group of integers modulo n>. Equivalently,
$$
\boxed{\operatorname{ord}_n(b)=\varphi(n)}.
$$