Let $G$ be a finite group and let $N$ be a normal subgroup of $G$. Let's call $N$ $\mathcal{U}$-central in $G$ if it is true that all $G$-chief factors below $N$ are cyclic. Now put $$Z_{\mathcal{U}}(G) := \langle N:\, \text{$N$ is $\mathcal{U}$-central in $G$}\, \rangle.$$ The goal is to construct the subgroup $Z_{\mathcal{U}}(G)$ in GAP and I have done this as follows:
ucentral:=function(g,n)
local list, h, k, quo, subquo, hom;
list:=Filtered(NormalSubgroups(g),x->IsSubgroup(n,x));
for k in list do
hom:=NaturalHomomorphismByNormalSubgroup(g,k);
quo:=Image(hom,g);
for h in Filtered(list,x->IsSubgroup(x,k)) do
subquo:=Image(hom,h);
if subquo in MinimalNormalSubgroups(quo) then
if not IsCyclic(subquo) then
return false;
fi;
fi;
od;
od;
return true;
end;;
sshypercenter:=function(g)
local prod, norm, n;
if IsSupersolvableGroup(g) then
return g;
fi;
prod:=TrivialSubgroup(g);
norm:=NormalSubgroups(g);
for n in norm do
if ucentral(g,n) then
prod:=ClosureGroup(prod,n);
fi;
od;
return prod;
end;;
I suppose there isn't much that can be done to improve the sshypercenter routine. The question I have is whether it is possible to do better with the ucentral routine either in terms of efficiency or presentation (or both).
I would use the Jordan-Hölder theorem to deal with the chief factors: Calculate one chief series, then , to test whether $N$ is u-central, check whether all chief factors in the given series covered by $N$ (these will give the $G$-chief factors of $N$) are cyclic.
To find $Z_U$, you should be able to build it upwards according to the chief series: For this it is sufficient to find the minimal normal subgroups of $G$ in $Z_U$ (since after that you go to the factor group of what you found so far and repeat), which are simply the minimal cyclic normal subgroups.
To find the minimal cyclic normal subgroups, ascend along the one chosen chief series. For each cyclic chief factor $C_i/C_{i+1}$ find the normal complements to $C_{i+1}$ in $C_i$, and check which ones are normal in $G$.
This will abvoid the need to find and test all normal subgroups.