Number of Ring homomorphisms $\phi:\mathbb{Z}_{12}\longrightarrow\mathbb{Z}_{12}$ How could I determine the number of homomorphisms of rings with identity $1_A$ from $\mathbb{Z}_{12}$ to $\mathbb{Z}_{12}$? And how this number change if I consider the homomorphisms of rings without the identity element? I've always seen this kind of problem with the homomorphisms of groups from $\mathbb{Z}_n$ to $\mathbb{Z}_m$, but how can I extend it to unitary and non-unitary rings? 
 A: Hint: A ring morphism $\phi: \mathbb{Z}_{12} \to \mathbb{Z}_{12}$ is uniquely determined by what it does to a generator, say to $1$.
Also, the additive order of the image of $1$ must divide $12$. 
How many ring morphisms can you obtain this way?
A: In general all ring homomorphisms from $\mathbb Z_{m}$ to $\mathbb Z_{n}$ are the functions $f$ satisfying $mf(1)=0$ and $f(1)^2=f(1)$. 
So for $m=n=12$, the maps : 
$\begin{align}\bar 1 &\mapsto\bar 1\\\bar 1 &\mapsto\bar 5\\\bar 1 &\mapsto\bar 7\\\bar 1 &\mapsto\bar{11}\end{align}\tag*{}$
satisfy these properties.
Why I choose this numbers as the images of $\bar 1$? Because these numbers $(1, 5, 7, 11)$ are less than $12$ and prime to $12$. So each of these number alone can generate the image $\mathbb Z_{12}$. 
So these are all ring homomorphisms from $\mathbb Z_{12}$ to $\mathbb Z_{12}$.
A: All ring homomorphisms $\varphi:\mathbb{Z}_n\to\mathbb{Z}_n$ are of the form $\varphi(x)=ax$, and $\varphi$ is a ring homomorphism if and only if $a\equiv a^2 \mod n$.
To prove this, assume $\varphi$ is a ring homomorphism. Then $a \equiv \varphi(1) \equiv \varphi(1^2)\equiv\varphi(1)^2\equiv a^2 \mod n$.
For the second part, $\varphi(x+y) = a(x + y) = ax + ay = \varphi(x) + \varphi(y)$ is already known. If $a\equiv a^2$, then $\varphi(xy) \equiv axy \equiv a^2xy \equiv axay \equiv \varphi(x)\varphi(y)\mod n$, and this finishes the proof.
Since the ring $\mathbb{Z}_n$ has 4 idempotent elements $(0, 1, 4, 9)$, there are $4$ homomorphism between $\mathbb{Z}_n$ and $\mathbb{Z}_n$.
These articles can be helpful: 
The number of homomorphisms from $\mathbb{Z}_n$ to $\mathbb{Z}_m$
The number of ring homomorphisms from $\mathbb{Z}_n$ to $\mathbb{Z}_n$
