$\mathbb{Z}/\mathbb{nZ}$ admits idempotents [duplicate]

I need to show that if $n$ is not a prime power,then $\mathbb{Z}/\mathbb{nZ}$ admits idempotents $\neq 0,1$

I noticed this thing for $\mathbb{Z_6}$ and $\mathbb{Z_{12}}$ and few more but how do we show that there will always exists such $a$?

• If $n$ is not a prime power, there are at least two distinct primes $p,q$ dividing $n$. How are the idempotents in $\mathbb{Z}_6$ and $\mathbb{Z}_{12}$ related to $p$ and $q$? – Daniel Fischer Sep 17 '13 at 19:51
• they're power of prime! – Bhauryal Sep 17 '13 at 19:53
• Your question has been discussed in Idempotents in $Z\_n$. Basically Chinese Remainder Theorem allows you to reduce to the case, where $n$ is a prime power. The total number of idempotents is $2^k$, where $k$ is the number of distinct prime factors of $n$. – Jyrki Lahtonen Sep 17 '13 at 19:54
• No, $6^2 = 36 \equiv 0 \pmod{18}$. But $10^2 \equiv 10 \pmod{18}$. So it's not prime powers. – Daniel Fischer Sep 17 '13 at 19:58
• Neeraj, what you could notice from Daniel's example ($10$ an idempotent modulo $18$) is that $10\equiv1\pmod9$ and $10\pmod 0\pmod2$, so $10$ is an (trivial) idempotent modulo both the prime power factors of $18$. That's the way it always pans out. – Jyrki Lahtonen Sep 17 '13 at 20:03