This is a question from Contemporary Abstract Algebra which asks:
Find an integer $n > 1$ such that $a^n = a$ for all $a$ in $Z_6$. Show that no such $n$ exists for $Z_m$ when $m$ is divisible by the square of some prime.
I could search for $n=3$ in case of $Z_6$. But I am not able to proceed with the proof the second part. Being a beginner I don't have much idea. Some help would be great. Thanks in advance.
Let $m$ be any positive integer. Then $\varphi(m)$ denotes the number of integers in the set $\{ 1, \ldots, m \}$ that are relatively prime to $m$.
Thus we have $$ \varphi(1) = 1, \ \varphi(2) = 1, \ \varphi(3) = 2, \ \varphi(4) = 2, \ \varphi(5) = 4, $$ and so on.
If $p$ is any prime, then we have $$ \varphi(p) = p-1. $$
If $$ m = p_1^{\alpha_1} \cdots p_r^{\alpha_r}, $$ where $p_1 < \cdots < p_r$ are distinct primes and $\alpha_1, \ldots, \alpha_r$ are the positive integeral exponents, is the unique prime factorisation of $m$, then we have the formula $$ \varphi(m) = m \left( 1 - \frac{1}{p_1} \right) \cdots \left( 1 - \frac{1}{p_r} \right). $$
If $a$ is any integer relatively prime to $m$, then we have the Euler's formula $$ a^{\varphi(m)} \equiv 1 (\mod m), $$ and so $$ a^{1+\varphi(m)} \equiv a (\mod m), $$
Finally, in $Z_m$, two elements $a$ and $b$ are equal if and only if the integers $a$ and $b$ are congruent $\mod m$.
Thus if $m$ is a prime, then $$ a^{1+\varphi(m)} = a$$ in $\mathbb{Z}_m$.
If $m = p^2 r$, where $p$ is a prime and $r$ is any positive integer, then $p \in \mathbb{Z}_m$ and we notice that $$ p^2 \neq p, $$ and hence $$ p^3 = pp^2 \neq p, $$ for otherwise we would get $$ p^2 = 1,$$ that is, $$ p^2 \equiv 1 (\mod p^2 r), $$ which is the same as $$ p^2 r \, | \, \left( p^2 - 1 \right), $$ and so $$ p^2 - 1 = p^2rq, $$ where $q$ is an integer (and of course $q > 0$), which implies that $$ 1 = p^2 - p^2rq = p^2 (1 - rq), $$ which clearly is impossible since both $r$ and $q$ are positive integers.
Continuing in this way if $n > 3$ and if $p^n = p$ in $\mathbb{Z}_m$, then we would get $$ p^{n-1} = 1$$ in $\mathbb{Z}_m$, that is, $$ p^{n-1} \equiv 1 ( \mod m), $$ and so $$ p^{n-1} - 1 = p^2rq_0, $$ where $q_0$ is an integer (greater than $0$ of course), and thence $$ 1 = p^2 \left(1 - r q_0 \right), $$ which is impossible since both $q_0$ and $r$ are positive integers.