Solution (source code)

= Solution
{c}

We first establish the <nilradical as the intersection of prime ideals>:
$$
\operatorname{Nil}(A)=\bigcap_{\mathfrak p\in\operatorname{Spec}A}\mathfrak p.
$$
Every <nilpotent element> belongs to every <prime ideal>. In the other direction, if $a$ is not nilpotent, the <multiplicative subset> $T=\{1,a,a^2,\ldots\}$ avoids zero. By the <Zorn lemma>, there is an <ideal> $J$ maximal among those disjoint from $T$. It is a <prime ideal>: if $uv\in J$ and neither $u$ nor $v$ belongs to $J$, then $J+(u)$ and $J+(v)$ each meet $T$. Multiplying elements in these two intersections gives an element of $T$ lying in $J$, a contradiction. Since $a\notin J$, this proves the identity. The identity also holds for the zero <ring>, with the intersection over an empty family interpreted as the whole <ring>.

A <Zariski-closed set> $V_R(I)$ contains the image of $f$ exactly when
$$
I\subseteq\bigcap_{\mathfrak q\in\operatorname{Spec}S}\varphi^{-1}(\mathfrak q)
=\varphi^{-1}(\operatorname{Nil}(S))
=\sqrt{\ker\varphi}.
$$
The last equality follows because $\varphi(r)$ is a <nilpotent element> exactly when $r^n\in\ker\varphi$ for some $n\geq1$. Consequently the smallest <Zariski-closed set> containing the image, namely its <closure>, is
$$
\overline{f(\operatorname{Spec}S)}=V_R(\sqrt{\ker\varphi})=V_R(\ker\varphi).
$$
This is all of $\operatorname{Spec}R$ precisely when the <kernel of a ring homomorphism> is contained in every <prime ideal> of $R$. Hence
$$
\boxed{f(\operatorname{Spec}S)\text{ is dense in }\operatorname{Spec}R
\iff\ker\varphi\subseteq\operatorname{Nil}(R).}
$$