Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 2212
# Load invertibility mod 2 data. Each line has the form "p r1 r2" where # p is a prime, r1 is True or False according to whether the matrix of T_2 # acting on S_2(Gamma_0(p), F_2) is invertible, and r2 similarly for T_2+1.
f = open("mod2ranks-500000.txt", "r") l = [] d = {} for s in f: if s.isspace(): continue p, r1, r2 = s.split(" ") p = Integer(p); r1 = eval(r1); r2 = eval(r2) l.append((p, r1, r2)) d[p] = (r1, r2) f.close() print("Invertibility data loaded successfully.")
Invertibility data loaded successfully.
# Check that each prime appears exactly once. print([i[0] for i in l] == prime_range(3, 500000))
True
# Test some correlations. for (p, r1, r2) in l: if p%8 == 3 and r1: print("a", p) if p%8 != 7 and r2: print("b", p)
('a', 3) ('b', 3) ('b', 5) ('b', 11) ('b', 13) ('b', 19) ('b', 37) ('b', 43) ('b', 67) ('b', 163)
# Compute percentages, prepare plots. l1 = []; l2 = []; l3 = []; l4 = []; i1 = 0; j1 = 0; i2 = 0; j2 = 0; i3 = 0; j3 = 0; i4 = 0; j4 = 0 for (p, r1, r2) in l: if p%8 == 1: i1 += 1 if not r1: j1 += 1 if p > 1000: l1.append((log(p), j1/i1)) if p%8 == 5: i2 += 1 if not r1: j2 += 1 if p > 1000: l2.append((log(p), j2/i2)) if p%8 == 7: i3 += 1 if not r1: j3 += 1 if p > 1000: l3.append((log(p), j3/i3)) i4 += 1 if not r2: j4 += 1 if p > 1000: l4.append((log(p), j4/i4))
# Data for p == 1 mod 8, e == 0; p == 5 mod 8, e == 0; p == 7 mod 8, e == 0; p == 7 mod 8, e == 1 print 1.0 * j1/i1, 1.0 * j2/i2, 1.0 * j3/i3, 1.0 * j4/i4 show(points(l1, color='darkgreen', pointsize=2, aspect_ratio=90), points(l2, color='darkgreen', pointsize=2, aspect_ratio=50), points(l3, color='darkgreen', pointsize=2, aspect_ratio=70), points(l4, color='darkgreen', pointsize=2, aspect_ratio=20))
0.167698858138185 0.421660094257959 0.172603003465537 0.479303041971506
# Compute proportion of kernel computations which can be avoided by prescreening using invertibility mod 2. i=j=0 for (p, r1, r2) in l: j += 5 if r1: i += 3 if r2: i += 2 print 1.0*i/j
0.387442521125743