How many elements of a cyclic groups of order $n$ are generators for that group? Actually,I already know the answer is the value of Euler's function at $n$. And I use $n$th root of unity to verify one by one until $n=4.$ But though I have tried something, I still have no idea about how to prove the assertion. Then the Euler's function reminded me to think about the prime number decomposition theorem,but no more progress
 A: Let $G$ be a cyclic group of order $n \ge 2$ (things are trivial for the trivial group $G=\{e\}$). For any $g \in G$, let $\langle g\rangle := \{g^k \mid 1 \le k \le n\}$ be the subgroup generated by $g$. The number of distinct elements of $\langle g\rangle$ is called the order of $g$, denoted $|g|$.
Thus, $|g|  = k$ iff $\langle g\rangle = \{e,g,g^2,\ldots, g^{k-1}\}$ is a set of size $k$.

Observation. Because $\langle g\rangle$ is a subgroup of $G$, $|g|$ divides $n$.

Now, let $g$ be any generator of $G$, i.e $\langle g\rangle = G$, or equivalently $|g|=n$.

Claim. Let $m \in [1,n-1] := \{1,2,\ldots,n-1\}$. Then $g^m$ generates $G$ iff $m$ is coprime to $n$.

Once the above claim is proved, it will follow that the number of generators of $n$ is $\varphi(n)$, the number of $m \in [1,n]$ which are coprime to $n$.
Proof of claim. First, if $m$ is coprime to $n$, then $(g^m)^k \ne e$ for all $k \in [n-1]$ (thanks to the Observation above). Thus $\langle g^m\rangle$ contains $n$ elements, i.e $g^m$ generates $G$.
On the other hand, if $g^m$ is a generator of $G$, then $m$ is coprime to $n$. Otherwise, we would have $m=km'$ and $n=kn'$ for some $k,n',m' \in [n-1]$ with $k \ge 2$, and so
$$
(g^m)^{n'} = g^{mn'}=g^{km'n'} = (g^{kn'})^{m'} = (g^n)^{m'} = e^{n'} = e.
$$
Thus, we would have $|g^m| \le n' \le n-1 < n$, and so $g$ wouldn't generate $G$, a contradiction! $\quad\Box$
