Solution (source code)

= Solution

\b[There are six <functions>: the four power maps $x\mapsto x^k$ for $k=1,2,3,4$, and the two constant maps $0,1$.] All calculations in this part are in the <finite field> $\mathbb Z_5$.

Put $e=f(1)$. Multiplicativity gives $e^2=e$, so the absence of <zero divisors> forces $e=0$ or $e=1$. If $e=0$, then $f(x)=f(x)f(1)=0$ for every $x$, giving only the constant-zero map.

Suppose $e=1$. For nonzero $x$, the equality $f(x)f(x^{-1})=1$ shows $f(x)\ne0$. The nonzero elements form a <cyclic group> generated by $2$, in the order $1,2,4,3$. Choosing $a=f(2)$ determines every value on this group by $f(2^j)=a^j$. Each $a\in\{1,2,3,4\}$ satisfies $a^4=1$, so all four choices give consistent <group homomorphisms>.

Finally, $z=f(0)$ satisfies $z^2=z$ and $z=zf(x)$ for every $x$. The choice $z=0$ works for all four group maps. The choice $z=1$ forces every nonzero value to be $1$, giving one extra map, the constant-one map. Thus the count is $1+4+1=6$. The four zero-preserving possibilities are exactly the four displayed power maps. This is the special case with five elements of <multiplicative self-maps of a finite field>.