E = EllipticCurve(K, [1,1,a+1,-a+1,-a]) #no primes of bad reduction
L = []
for p in primes(100):
t = K.primes_above(p)
if E.has_good_reduction(t[0]) and norm(t[0]) <= 100:
L = L + t
#print L
#print len(L)
############# Now L (list of primes) is defined ##############
def apdictionary(line): #feed in line
aps = line_parser(line)
d = {}
for i in range(24):
d[str(L[i])] = aps[i] #assigns proper ap value for each prime
return d
def line_parser(s):
r=s[24:100];r
t=r.split()
return [modified_eval(i) for i in t]
def modified_eval(s):
if s == '?':
return s
else:
return eval(s)
###############################################################
def ap(p,line): #returns a particular aps value from d
return (apdictionary(line))[str(p)]
R.<x> = GF(2)[]
def frob(p,line):
return x^2 - ap(p,line)*x + int(p.norm())
def disc(p,line):
t = ap(p,line)
return t^2 - 4*p.norm()
###############################################################
def isogeny_primes_readin(norm_bound, isog_degree_bound, line):
dic = apdictionary(line)
P = [p for p in L if dic[str(p)] != '?']
w = set(primes(isog_degree_bound+1))
i = 0
w.remove(2)
while len(w) > 0 and i < len(P):
d = disc(P[i],line)
w = [ell for ell in w if not (legendre_symbol(d,ell) == -1)]
i = i +1
i = 0
while i < len(P):
if frob(P[i],line).is_irreducible():
break
i = i+1
if i == len(P):
w.insert(0,2)
return w