I have following Gap's code:
Summands := function(G) 

local n, i, sgl, l, A, B, D;# ensure that the group G is finite and abelian
if not IsGroup(G) or not IsFinite(G) or not IsAbelian(G) then 
  Error("Usage: DirectSummands(<G>) - where <G> is a finite abelian group\n");
fi;

# obtain a list of all subgroups
sgl := List(LatticeSubgroups(G)!.conjugacyClassesSubgroups, Representative);

# n is the number of divisors of |G|
n := Size(DivisorsInt(Size(G)));

D := [];

if IsOddInt(n) then l := QuoInt(n + 1, 2);
               else l := QuoInt(n, 2);
fi;

for i in [1..l] do
  for A in Filtered(sgl, function(g) return Size(g) = DivisorsInt(Size(G))[i]; 
end) do
    for B in Filtered(sgl, function(g) return Size(g) = 
DivisorsInt(Size(G))[n+1-i]; end) do
        Add(D, [A, B]);
    od;
  od;
od;

return D;
end;
I want to change to sage but I don't have aye idea? thanks in an advance

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to