How do I find a primitive root for a given $n$?
For which $n$ does a primitive root exist (I would have guessed it's for all $n$ which are not divisible by 8)?
Is there a systematic way, to constuct all primitive roots for a given $n$?
I want to achieve this (if possible) without trial and error of calculating the discrete logarithm.
It can be proven that a primitive root modulo $n$ exists if and only if $$n \in \{ 1,2 , 4, p^k, 2 p^k \}$$ with $p$ odd prime.
For each $n$ of this form there are exactly $\phi(n)$ primitive roots.
As far as I know there is no closed formula for finding the primitive roots modulo $n$.