Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 44
#'mutliplies' two vectors as if they were polynomials, with the 0th index being the constant term def vector_mult(v, w): return vector([v[0]*w[0], v[1]*w[0]+v[0]*w[1], v[0]*w[2] + v[2]*w[0] + v[1]*w[1], v[0]*w[3] + v[3]*w[0] + v[1]*w[2] + v[2]*w[1], v[0]*w[4] + v[1]*w[3] + v[2]*w[2] + v[3]*w[1] + v[4]*w[0], v[0]*w[5] + v[1]*w[4] + v[2]*w[3] + v[3]*w[2] + v[4]*w[1] + v[5]*w[0]]) #checks if a vector has integer coefficients- needed for check_if_subring def is_integral(v): for i in v: if i not in ZZ: return false return true #checks if a matrix corresponds to a subring def check_if_subring(A): for i in range(A.nrows()): for j in range (A.nrows()): if not is_integral(A.solve_right(vector_mult(A.column(i), A.column(j)))): return false return true p = 2 number_of_subrings = 0 #Matrices are set up differently than we have in the paper. The computations are run on matrices in Hermite Normal form, but are lower triangular instead of upper triangular. #If this is too confusing I can change it. I also translate all the data back to the conventions of the paper before recording it in the spreadsheet #code for diagonal (1, 0, 1, 0, 1) #for a_1 in range(p): # for a_2 in range(p): # for b_1 in range(p): # for b_2 in range(p): # for b_3 in range(p): # for b_4 in range(p): # S = Matrix([[1, 0, 0, 0, 0, 0], [0, p, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, a_1, a_2, p, 0, 0], [0, 0, 0, 0, 1, 0], [0, b_1, b_2, b_3, b_4, p]]) # if check_if_subring(S): # number_of_subrings = number_of_subrings + 1 #code for diagonal (1, 0, 0, 1, 1) #for a_1 in range(p): # for b_1 in range(p): # for b_2 in range(p): # for b_3 in range(p): # for b_4 in range(p): # S = Matrix([[1, 0, 0, 0, 0, 0], [0, p, 0, 0, 0, 0], [0, a_1, p, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, b_1, b_2, b_3, b_4, p]]) # if check_if_subring(S): # number_of_subrings = number_of_subrings + 1 #code for diagonal (0, 1, 0, 1, 1) #for a_1 in range(p): # for b_1 in range(p): # for b_2 in range(p): # for b_3 in range(p): # S = Matrix([[1, 0, 0, 0, 0, 0], [0, p, 0, 0, 0, 0], [0, a_1, p, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, b_1, b_2, b_3, p, 0], [0, 0, 0, 0, 0, 1]]) # if check_if_subring(S): # number_of_subrings = number_of_subrings + 1 #code for diagonal (0, 0, 1, 1, 1) #for a_1 in range(p): # for b_1 in range(p): # for b_2 in range(p): # S = Matrix([[1, 0, 0, 0, 0, 0], [0, p, 0, 0, 0, 0], [0, a_1, p, 0, 0, 0], [0, b_1, b_2, p, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]]) # if check_if_subring(S): # number_of_subrings = number_of_subrings + 1 #code for diagonal (1, 0, 1) #for a_1 in range (p): # for a_2 in range (p): # S = Matrix([[1, 0, 0, 0, 0, 0], [0, p, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, a_1, a_2, p, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]]) # if check_if_subring(S): # number_of_subrings = number_of_subrings + 1 p = 5 #code for diagonal (0, 1, 1) #for a in range (p): # S = Matrix([[1, 0, 0, 0, 0, 0], [0, p, 0, 0, 0, 0], [0, a, p, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 1]]) # if check_if_subring(S): # number_of_subrings = number_of_subrings + 1 number_of_subrings
5
#computes all possible diagonals for e = 3 possible_diagonals = [] for n_1 in range(4): for n_2 in range(4): for n_3 in range(4): for n_4 in range(4): for n_5 in range(4): if n_1 + n_2 + n_3 + n_4 + n_5 == 3 and 2*(n_1) >= n_2 and n_2 + n_1 >= n_3 and 2*(n_2) >= n_4 and n_3 + n_1 >= n_4 and n_2+n_3 >= n_5 and n_4 + n_1 >= n_5: possible_diagonals.append([n_1, n_2, n_3, n_4, n_5]) possible_diagonals
[[1, 0, 1, 0, 1], [1, 1, 0, 0, 1], [1, 1, 0, 1, 0], [1, 1, 1, 0, 0], [1, 2, 0, 0, 0], [2, 0, 1, 0, 0], [2, 1, 0, 0, 0], [3, 0, 0, 0, 0]]
for j in range(4): %time factor(2^(265+j)+1)
3 * 11 * 107 * 28059810762433 * 593783678966863030035641 * 1007715965875748226745472989687556259131 CPU time: 26.97 s, Wall time: 27.63 s 5 * 29 * 113 * 229 * 457 * 1597 * 2129 * 525313 * 126848469231149 * 679253585011429 * 449329386292232535250647435097 CPU time: 0.61 s, Wall time: 0.63 s 3^2 * 179 * 3739 * 4273 * 62020897 * 18584774046020617 * 7993364465170792998716337691033251350895453313 CPU time: 0.92 s, Wall time: 0.93 s 17 * 75041 * 333808138537249 * 1113767094422199900605896348724787045161997478687751948513969 CPU time: 0.73 s, Wall time: 0.74 s
#computing all possible diagonals for e = 2 possible_diagonals = [] for n_1 in range(3): for n_2 in range (3): for n_3 in range (3): if n_1 + n_2 + n_3 == 2 and 2*(n_1) >= n_2 and n_1 + n_2 >= n_3: possible_diagonals.append([n_1, n_2, n_3]) possible_diagonals
[[1, 0, 1], [1, 1, 0], [2, 0, 0]]
#computes all possible diagonals for e = 4 (except the diagonal (0, 0, 0, 0, 0, 0, 4)) possible_diagonals = [] def check_if_admissable(l): for i in [1..len(l)-1]: for j in [0..i-1]: if l[i] > l[j] + l[i-j-1]: return false return true for n_1 in range(4): for n_2 in range(4): for n_3 in range(4): for n_4 in range(4): for n_5 in range(4): for n_6 in range(4): for n_7 in range(4): if n_1+n_2+n_3+n_4+n_5+n_6+n_7 == 4 and check_if_admissable([n_1, n_2, n_3, n_4, n_5, n_6, n_7]): possible_diagonals.append([n_1, n_2, n_3, n_4, n_5, n_6, n_7]) possible_diagonals
[[1, 0, 1, 0, 1, 0, 1], [1, 1, 0, 1, 0, 0, 1], [1, 1, 0, 1, 1, 0, 0], [1, 1, 1, 0, 0, 0, 1], [1, 1, 1, 0, 0, 1, 0], [1, 1, 1, 0, 1, 0, 0], [1, 1, 1, 1, 0, 0, 0], [1, 1, 2, 0, 0, 0, 0], [1, 2, 0, 0, 1, 0, 0], [1, 2, 0, 1, 0, 0, 0], [1, 2, 1, 0, 0, 0, 0], [2, 0, 1, 0, 1, 0, 0], [2, 0, 2, 0, 0, 0, 0], [2, 1, 0, 0, 1, 0, 0], [2, 1, 0, 1, 0, 0, 0], [2, 1, 1, 0, 0, 0, 0], [2, 2, 0, 0, 0, 0, 0], [3, 0, 1, 0, 0, 0, 0], [3, 1, 0, 0, 0, 0, 0]]