Ring automorphisms of $\mathbb{Z}$ quotients and their products How many ring automorphisms are there of $\mathbb{Z}/n\mathbb{Z}$? Calling such rings $A_n$, how many ring automorphisms are there of $\prod_1^n A_{n_j}$?
 A: For $\mathbb{Z}/n\mathbb{Z}$, the only ring automorphism is the identity. For finite products, the only nontrivial automorphisms come from exchanging prime-power order direct factors. 
A group homomorphism of $\mathbb{Z}/n\mathbb{Z}$ to itself is completely determined by the image of $1+n\mathbb{Z}$. In order to be a group automorphism, you must map it to $a+n\mathbb{Z}$ with $\gcd(a,n)=1$. If $1\mapsto a$, then it is easy to verify that the homomorphism is just $r+n\mathbb{Z}\longmapsto ar+n\mathbb{Z}$.
But in order to be a ring isomorphism, we also require that it respects products. Therefore, the image of $bc$ must be the product of the images of $b$ and $c$; since $1^2=1$, we must have that $a^2\equiv a\pmod{n}$. And since $\gcd(a,n)=1$, this means that $a\equiv 1\pmod{n}$, so the map is the identity.
For the second problem, I'm assuming a finite number of direct factors. The Chinese Remainder Theorem establishes a ring isomorphism between $\mathbb{Z}/n\mathbb{Z}$ and the direct product of the rings $\mathbb{Z}/p_i^{a_i}\mathbb{Z}$, where $n=p_1^{a_1}\cdots p_r^{a_r}$ is a factorization of $n$ into prime powers of distinct primes, so we lose no generality by assuming that each $n_j$ is a prime power. Moreover, we may assume all $n_j$ are powers of the same prime $p$, since maps between direct factors corresponding to distinct primes must be the zero map.
Now, the only nontrivial idempotents in $\mathbb{Z}/p^a\mathbb{Z}$ are $0$ and $1$; this can be established easily using congruences; alternatively, note that a nontrivial idempotent $e$ in a commutative ring $R$ with unity will yield a direct product decomposition $Re \times R(1-e)$, and since $\mathbb{Z}/p^a\mathbb{Z}$ is indecomposable, it follows that if $e$ is idempotent then $e=1$ or $e=0$. 
Let $R = \mathbb{Z}/p^{a_1}\mathbb{Z}\times\cdots\times\mathbb{Z}/p^{a_r}\mathbb{Z}$, with $1\leq a_1\leq\cdots\leq a_r$. And we consider the automorphisms of $R$.
Now, as a group, the product is generated by the idempotents $\mathbf{e}_i$, where $\mathbf{e}_i$ has a $1$ in the $i$th coordinate and $0$s elsehwere. Their images must be idempotents, so they must be of the form $(b_1,\ldots,b_r)$ with $b_i$ idempotent, hence $b_i\in \{0,1\}$. In particular, if $a_i\lt a_j$, then the $j$th coordinate of the image of $\mathbf{e}_i$ must be $0$, by considering the additive order of $\mathbf{e}_i$.
Now, since $\mathbf{e}_i\mathbf{e}_j = (0,0,\ldots,0)$ if $i\neq j$ (the idempotents are "mutually orthogonal"), it follows that the support of the image of $\mathbf{e}_i$ (the coordinates with nonzero component) must be disjoint from the support of the image of $\mathbf{e}_j$ if $i\neq j$. 
Let $t$ be the largest index such that $a_t=a_1$. Then since $\mathbf{e}_i$, $1\leq i\leq t$ must be mapped to some idempotent in $\mathbb{Z}/p^{a_1}\mathbb{Z}\times\cdots \times\mathbb{Z}/p^{a_t}\mathbb{Z}$, and different $\mathbf{e}_i$ must map to mutually orthogonal idempotents, it follows that any automorphism of $R$ must simply permute the $\mathbf{e}_i$, $1\leq i\leq t$. Looking at the next largest power of $p$ that occurs we see therefore that the same thing must occur, etc. Thus, if the ring is of the form
$$\left(\frac{\mathbb{Z}}{p^{a_1}\mathbb{Z}}\right)^{n_1}\times\cdots\times \left(\frac{\mathbb{Z}}{p^{a_s}\mathbb{Z}}\right)^{n_s}$$
with $1\leq a_1\lt \cdots \lt a_s$, $n_i\geq 1$, then the only automorphisms correspond to permutations of the factors of $\mathbb{Z}/p^{a_i}\mathbb{Z}$ for each $i$. Hence there are $(n_1!)\cdots (n_s!)$ such automorphisms. 
In the case of a single factor, we get $s=1$ and $n_1=1$, so we get the previous result as a special case.
