Constructing CM elliptic curves with minimal Galois image Riccardo Pengo 5 How to face our first challenge To implement the algorithm, we need the following steps: • write a function ellcmdisc(E) which takes as input an elliptic curve E defined over a number field F and returns 1 if E does not have complex multiplication, and otherwise returns the discriminant ∆O ∈ Z of the imaginary quadratic order O such that EndF (E) ∼ = O; • write a function elldivfield(E,n) which takes as input an elliptic curve E defined over a number field F, and an integer n ∈ N (or, more generally, an element n ∈ EndF (E)), and outputs an irreducible polynomial f (x) ∈ K[x] such that the number field F[x]/(f ) is the n-division field F(E[n]) of E; • write a function nfrelativize(f,g) which, given two irreducible polynomials f ,g ∈ Q[x] and some embedding K := Q[x]/(f ) ,→ F := Q[x]/(g), returns a polynomial h(y) ∈ K[y] such that F ∼ = K[y]/(h); • write a function subab(K,f,{flag = 0}) which, given a number field K and an irreducible polynomial f ∈ K[x], returns another irreducible polynomial g ∈ K[x] such that K[x]/(g) is the maximal abelian sub-extension of L := K[x]/(f ). If flag = 1, return just the degree [L∩Kab : K]. Then, we can easily compute I (E/F), using quadclassunit to compute |Pic(O)|.