ringHoms:=function(n) local R, e, h, f, l, j ; R:= Integers mod n; e:= Elements(R); l:= []; Print("The map f: Z_", n, " -> Z_", n, " given by f(x) = mx is a homomorphism for m="); for j in [1..Size(e)] do h := x -> e[j]*x; f := MappingByFunction(R,R,h); if IsRingHomomorphism(f) then Append(l,[Int(e[j])]); fi; od; return l; end;