Skip to content

Instantly share code, notes, and snippets.

@AndyNovo
Created June 15, 2016 15:58
Show Gist options
  • Save AndyNovo/c6b6a8dcf781fc847be6e41e368c4455 to your computer and use it in GitHub Desktop.
Save AndyNovo/c6b6a8dcf781fc847be6e41e368c4455 to your computer and use it in GitHub Desktop.
B0 = Matrix(GF(3), 5, 5)
B1 = Matrix(GF(3), 5, 5)
B2 = Matrix(GF(3), 5, 5)
B0[1,0] = 1
B0[4,1] = 1
B1[0,0] = -1
B1[1,1] = -1
B1[2,2] = 1
B1[3,1] = -1
B1[4,2] = -1
B2[0,1] = -1
B2[0,3] = 1
B2[1,2] = -1
B2[2,1] = 1
B2[2,3] = 1
B2[3,2] = -1
B2[3,4] = 1
B2[4,3] = -1
B=[B0,B1,B2]
def coeff(term, log3Degree):
return -prod([B[2-x] for x in Integer(term).digits(3, padto=log3Degree)]).trace()
for i in range(20):
print i, coeff(i, 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment