Problem: Let $G$ be a finite abelian group and $g\in G$. Then for any $k\in \mathbb{Z} $
\[
o\left( g^k \right) = \frac{o(g)}{\gcd (k, o(g))}.
\]
Hence or otherwise find all generators of a finite cyclic group $G$.
Use that the order of $g$ is $n$ to show that $\left( g^k \right) ^m = e$.
Use $\gcd \left( \frac{n}{\gcd (k,n)}, \frac{k}{\gcd \left( k,n \right) } \right) = 1,$ to show that $m$ is the smallest positive power of $a$ such that $\left( g^k \right) ^m = e$.
Solution: Let us denote $\frac{o(g)}{\gcd (k, o(g))}$ by $m$ and $o(g) = n$. We need to show two things:
$\left( g^k \right) ^m = e$ and
$m$ is the smallest positive power of $a$ such that $\left( g^k \right) ^m = e$.
For the first part note that we have $g^n = e$. So,
\begin{align*}
\left( g^k \right) ^{n / \gcd (k,n)} & = \left( g^n \right) ^{k / \gcd ((k,n))} = e.
\end{align*}
For the second part, let $p \in \mathbb{N} $ be such that $\left( g^k \right) ^ p = e$. We will show that $m \mid p$. Since
\begin{align*}
\left( g^k \right) ^p = e & \implies \left( g^{kp} \right) = e.
\end{align*}
Since $o(g) = n$, we must have $n \mid kp$. Since,
\begin{align*}
\gcd (k,n) \mid n & \implies \frac{n}{\gcd (k,n)} \mid \frac{kp}{\gcd (k,n)}.
\end{align*}
We also have,
\[
\gcd \left( \frac{n}{\gcd (k,n)}, \frac{k}{\gcd \left( k,n \right) } \right) = 1.
\]
Thus, $\displaystyle \frac{n}{\gcd (k,n) } \mid p$.
Note that if $\gcd (n,k) = 1,$ then $o\left( g^k \right) = o(g)$. Therefore, if $G$ is a cyclic group with a generator $g$, then the set of all generators of $G$ will be
\[
\left\{ g^k: \gcd (n,k) = 1 \right\} .
\]