A problem from D&F Abstract Algebra: find all ring homomorphisms $\mathbb{Z}\to\mathbb{Z}/30\mathbb{Z}$. Homomorphisms of general rings are assumed (not rings with unity).
My reasoning is as follows. Suppose $\varphi\colon\mathbb{Z}\to\mathbb{Z}/n\mathbb{Z}$ is a homomorphism. Any homomorphism from $\mathbb{Z}$ is uniquely determined by the image of $1$. Now, if $\varphi$ maps $1$ to $x\in\mathbb{Z}/n\mathbb{Z}$, then $x=\varphi(1)=\varphi(1)^2=x^2$, so $x$ is an idempotent. Conversely, if $x=x^2$ in $\mathbb{Z}/n\mathbb{Z}$, then the map $1\mapsto x$ extends to a homomorphism: $\forall a,b\in\mathbb{Z}\;\varphi(ab)=abx=abx^2=axbx=\varphi(a)\varphi(b)$. In the case $n=30$ one can find idempotents by hand, though the Chinese Remainder Theorem is of great help.
Here is my question: the CRT is not stated until 2 sections later in the book, so, did they mean the brute force solution of checking all elements for idempotence? Or is there a less computational (but elementary) approach?