function Max(x)
max := 0; L := [];
for i := 1 to x do
P2<x,y,z> := ProjectiveSpace(Rationals(),2);
C_i := Curve(P2, x^3+y^3-i*z^3);
E_i, C_itoE_i := EllipticCurve(C_i);
gen := Generators(E_i);
if max eq #gen then
max := #gen;
end if;
end for;
return max;
end function;
When I run this (Max(100)) it tells me that max = 0. However I know there are #gen = 1 and 2 at different places and therefore #gen > 0. I have having difficulty localizing max. It thinks of max outside the if and for statements as different than the max inside the for and if statements and thus is not updating max. I'm not sure how in magma CAS syntax I can correct for this. Can somebody help me understand Magma syntax with respect to this aspect? I tried putting local max; inside the loop and if statements but gave me syntax error.