# OBSOLETE: Rubinstein took down the .bic files and # posted gzipped ASCII files. # # Checks conjecture on the first two coefficients of the # modular polynomial using M. Rubinstein's files: # # phi_.bic # # # (reads from the old "binary compressed" files) import struct, sys out = open("/home/dept/finotti/tex/comp/check_phi.out","w") # chage to where you want to save the output fail=[] for p in prime_range(5,354): f = open("/scratch/mod_pol/bic/phi_" + str(p) + ".bic", "rb") # change to the location of the stored gzipped ASCII files res=[p] # read only first two coefficients while len(res) < 3: # reads len header = f.read(4) # convert to an integer (*** 64-bit?? ***) len_array = struct.unpack("i", header)[0] if len_array != 0: # non-zero coefficient # read other terms rest = f.read(6) # "H" = short int. (2 bytes) e2, e3, e5 = struct.unpack("HHH", rest) # print(len_array, e2, e3, e5) # get the sign if len_array > 0: sign=1 else: sign=-1 # terms of the sum in an array of bytes byte_array = f.read(abs(len_array)) # term is the last term of the product # that gives the coefficient (i.e., the sum) term, i = 0, 0 for b in byte_array: bi = struct.unpack("B", b)[0] term+=bi*(256**i) i+=1 # coefficient! # print(sign*(2**e2)*(3**e3)*(5**e5)*term) res+=[valuation(sign*(2**e2)*(3**e3)*(5**e5)*term,p)] else: # coefficient is zero # print(0) res+=[valuation(0,p)] f.close() print res if (p.mod(6) == 1) and ((res[1] != +Infinity) or (res[2] != +Infinity)): fail+=[res] if (p.mod(6) == 5) and ((res[1] != 3) or (res[2] != 3)): fail+=[res] out.write("p = " + str(p)) out.write(": [ " + str(res[1]) + " , " + str(res[2]) + " ]\n") out.write("\n\n"); out.write('"Failed" for:\n' + str(fail)) out.close()