def ap(E,p):
return E.change_ring(p.residue_field()).trace_of_frobenius()
R.<x> = GF(2)[]
def frob(E,p):
t = ap(E,p)
return x^2 - ap(E, p)*x + int(p.norm())
def disc(E, p):
t = ap(E, p)
return t^2 - 4*p.norm()
def isogeny_primes(E, norm_bound, isog_degree_bound):
P = [p for p in sqrt5.ideals_of_bounded_norm(norm_bound) if p.is_prime() and E.has_good_reduction(p)]
w = set(primes(isog_degree_bound+1))
i = 0
w.remove(2)
while len(w) > 0 and i < len(P):
d = disc(E, P[i])
w = [ell for ell in w if not (legendre_symbol(d,ell) == -1)]
i = i +1
i = 0
while i < len(P):
if frob(E,P[i]).is_irreducible():
break
i = i+1
if i == len(P):
w.insert(0,2)
return w