Find the number of idempotents in $\Bbb Z_{p^n}$ 
Find the number of idempotents in $\Bbb Z_{p^n}$.

Let $x$ be an idempotent in $\Bbb Z_{p^n}$. 
Then $x^2=x\mod p^n\implies p^n \mid x^2-x=x(x-1)$ 
Since $p\mid p^n\implies p\mid x(x-1)\implies p\mid x$ or $p\mid x-1\implies x\equiv 0\mod p$ or $x\equiv 1\mod p$
But I need the relations in $\Bbb Z_{p^n}$.
How to do it.I need some help.Will you please?
 A: Since $p$ must divide $x$ or $x-1$ but not both, then so does $p^n$.
EDIT: If $p^n|x(x-1)$ then $p\mid x$ or $p\mid x-1$. Let $r$ be the exponent of $p$ in $x$; that is, $r$ is the only natural such that $p^r\mid x$ but $p^{r+1}\not\mid x$ ($r$ can be $0$). Then $p^{n-r}\mid x-1$. Since $p$ can not divide both $x$ and $x-1$, then $r$ or $n-r$ is $0$. Thus $r$ or $n-r$ is $n$.
A: There are no nontrivial idempotents in $\mathbb{Z}/p^n\mathbb{Z}$, because the ring has a unique maximal ideal, namely $p\mathbb{Z}/p^n\mathbb{Z}$.
If $I$ is the unique maximal ideal of a commutative ring $R$ and $e$ is an idempotent, then $1=e+(1-e)$ implies that either $e$ or $1-e$ is invertible, because the sum of two noninvertible elements belongs to $I$ (prove it). The only invertible idempotent is $1$ (prove it).
A: A local ring cannot have non-trivial idempotents.
Indeed, if $\mathfrak m$ is maximal ideal of $R$ and $e$ is a idempotent in $R$, either $e$ is a unit, and $e^2=e$ implies $e=1$, or $e$ is not a unit, so it belongs to the unique maximal ideal and $1-e$ doesn't, hence is a unit, so that $1-e=1$ by the previous case, i.e. $e=0$.
A: $p^n\mid (1\!-\!x)x\,\Rightarrow\,p^n\mid 1\!-\!x\,$ or $\,p^n\mid x,\ $ by $\,1\!-\!x,\,x\,$ $\rm\color{#c00}{coprime}$ $ $ (by $\ 1\!-\!x\, +\,x\, =\, 1)$
