ringHoms := function(n) local R,e,h,f,l,j; R := Integers mod n; e := Elements(R); l := []; 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;