# Casson-Gordon

## 121 days ago by kminhoon

def saw(x): if x == int(x): return 0 else: return x-int(x)-1/2 def sawsum(m,q,r): return sum([4*saw(k*q/(m^2)) for k in range (1,m*r)])+2*saw(m*r*q/(m^2)) def semigroup(p,q): return [i*p+q*j for i in range(0,q) for j in range(0,p) if (i*p+q*j<(p-1)*(q-1))] def dedekind(p,q,x=0,y=0): return sum([saw((j+y)/q)*saw(x+p*(j+y)/q) for j in range(0,q)]) def Jabuka(p,q,n): return sum([(j/q-int(j/q)-1/2)*((j*p+n)/q-int((j*p+n)/q)-1/2) for j in range(0,q)]) def other_sig(m,q,r): return -4*dedekind(q,m*m)+4*dedekind(q,m*m,q*r/m,0) def sig(m,q,r): return 4*sum([saw(q*i/(m*m)) for i in range (1,r*m)])+2*saw(r*q/m) def third_sig(m,q,r): qp=inverse_mod(q,m^2) return -4*dedekind(qp,m^2)+4*dedekind(qp,m^2,-r/m,0) def Lsig(m,q,r): return -4*dedekind(q,m*m,(q-1)/(2*m*m),0)+4*dedekind(q,m*m,(q-1)/(2*m*m)+q*r/m,0) def sum_count(m,q,k,h): qp = inverse_mod(q,m^2) return sum([saw(qp*j/m^2) for j in range(k+1,k+h*m+1)]) def other_count(m,q,k,h): qp = inverse_mod(q,m^2) return dedekind(q,m^2,(k+h*m+1)/m^2,0) - dedekind(q,m^2,(k+1)/m^2,0) +(1/2)*saw((k+1)*qp/m^2) - (1/2)*saw((k+h*m+1)*qp/m^2) def list_count(m,q): if q % 2 == 0: rc = (m^2+q-1)/2 else: rc = (q-1)/2 return [2*other_count(m,q,rc,j)-j/m for j in range(1,m)] def list_sig(m,q): return [other_sig(m,q,r) for r in range(1,m)] def shifted_list_sig(m,q): return [1+other_sig(m,q,r) for r in range(1,m)] def mq_pass(m,q): for r in range(1,m): if abs(other_sig(m,q,r)) != 1: return False return True def alglen(p,q): i = 0 while q > 0: c = p % q p = q q = c i = i + 1 return i def make_list_for(m): return [q for q in range (2,m*m) if gcd(m,q) == 1 and mq_pass(m,q)] def comp_with_alg(m): return [(q,mq_pass(m,q),alglen(m^2,q)) for q in range(1,m^2) if gcd(m,q) == 1] def spin_orbit(m,q): if q % 2 == 0: return [(m+q-1)/2 % m + r*m for r in range (0,m)] else: return[(q-1)/2 % m + r*m for r in range (0,m)] def d(m,q,s): return 2*Jabuka(q,m^2,s)+dedekind(q,m^2,x=0,y=0)-1/(2*m^2) def list_d(m,q): return [inverse_mod(q,m^2),[d(m,inverse_mod(q,m^2),s) for s in spin_orbit(m,inverse_mod(q,m^2))]]
spin_orbit (11,1)
 `[0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110]`
list_sig(17,1)
 ```[-31, -59, -83, -103, -119, -131, -139, -143, -143, -139, -131, -119, -103, -83, -59, -31]```
list_d(17,1)
 `[1, [72, 56, 42, 30, 20, 12, 6, 2, 0, 0, 2, 6, 12, 20, 30, 42, 56]]`
list_d(17,2)
 `[145, [32, 18, 8, 2, 0, 2, 8, 18, 32, 24, 12, 4, 0, 0, 4, 12, 24]]`
list_sig(17,2)
 ```[-29, -51, -65, -71, -69, -59, -41, -15, -15, -41, -59, -69, -71, -65, -51, -29]```
list_sig(17,3)
 ```[-27, -43, -47, -39, -19, -9, -33, -45, -45, -33, -9, -19, -39, -47, -43, -27]```
list_d(17,3)
 `[193, [14, 4, 0, 2, 10, 24, 10, 2, 0, 4, 14, 18, 6, 0, 0, 6, 18]]`
list_d(17,38)
 `[251, [0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, -2, -2]]`
list_sig(17,38)
 `[-1, -3, -1, 1, 1, -1, 1, 3, 3, 1, -1, 1, 1, -1, -3, -1]`
list_sig(17,39)
 `[-3, -3, 1, -1, -1, -1, 1, -3, -3, 1, -1, -1, -1, 1, -3, -3]`
list_d(17,39)
 `[126, [0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0]]`
list_sig(17,40)
 `[-1, -3, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -3, -1]`
list_d(17,40)
 `[224, [0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, -2, 0]]`
list_d(17,41)
 `[141, [-4, -2, 0, 0, 2, 0, 0, -2, -4, -2, -2, 0, 0, 0, 0, -2, -2]]`
list_sig(17,41)
 `[1, 5, 7, 7, 9, 5, 5, -1, -1, 5, 5, 9, 7, 7, 5, 1]`
list_d(17,54)
 `[91, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]`
shifted_list_sig(17,54)
 `[2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2]`
list_d(17,54)
 `[91, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]`
shifted_list_sig(17,55)
 `[0, 2, 4, 6, 6, 4, 6, 8, 8, 6, 4, 6, 6, 4, 2, 0]`
list_d(17,55)
 `[268, [-2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2]]`
list_d(17,57)
 `[71, [-2, 0, 2, 0, -2, 0, 0, 0, -2, -2, 0, 0, -2, -2, 0, 0, 0]]`
list_sig(17,57)
 `[3, 5, 5, -1, 1, 5, 3, 1, 1, 3, 5, 1, -1, 5, 5, 3]`
list_sig(17,58)
 ```[-7, -11, -17, -21, -23, -27, -27, -29, -29, -27, -27, -23, -21, -17, -11, -7]```
list_sig(9,1)
 `[-15, -27, -35, -39, -39, -35, -27, -15]`
list_sig(9,2)
 `[-13, -19, -17, -7, -7, -17, -19, -13]`
list_d(9,1)
 `[1, [20, 12, 6, 2, 0, 0, 2, 6, 12]]`
list_d(9,2)
 `[41, [8, 2, 0, 2, 8, 4, 0, 0, 4]]`
list_d(9,4)
 `[61, [2, 0, 4, 0, 4, 0, 2, 0, 0]]`
list_sig(9,4)
 `[-9, -3, -7, -5, -5, -7, -3, -9]`
spin_orbit(9,61)
 `[3, 12, 21, 30, 39, 48, 57, 66, 75]`
list_d(9,5)
 `[65, [0, 2, 0, 4, 0, 2, 0, 0, 0]]`
list_d(9,7)
 `[58, [0, 0, 2, 2, 0, 0, 0, 2, 0]]`
list_d(9,8)
 `[71, [0, 0, 0, 0, 0, 0, 0, 0, 0]]`
list_d(9,4)
 `[61, [2, 0, 4, 0, 4, 0, 2, 0, 0]]`
list_d(9,5)
 `[65, [0, 2, 0, 4, 0, 2, 0, 0, 0]]`
list_d(9,7)
 `[58, [0, 0, 2, 2, 0, 0, 0, 2, 0]]`
list_d(9,8)
 `[71, [0, 0, 0, 0, 0, 0, 0, 0, 0]]`
list_d(9,10)
 `[73, [0, 0, 0, 0, 0, 0, 0, 0, 0]]`
list_d(9,11)
 `[59, [0, 0, 0, 2, 0, 0, 0, 0, 0]]`
list_sig(9,8)
 `[-1, -1, -1, -1, -1, -1, -1, -1]`
list_sig(9,10)
 `[1, 1, 1, 1, 1, 1, 1, 1]`
list_sig(9,11)
 `[-1, -3, -1, 1, 1, -1, -3, -1]`
list_sig(17,16)
 `[-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]`
list_sig(17,18)
 `[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]`
list_sig(17,19)
 `[-1, -3, -5, -7, -5, -3, -1, 1, 1, -1, -3, -5, -7, -5, -3, -1]`
list_d(17,19)
 `[213, [0, 0, 0, 0, 0, 2, 4, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0]]`
list_sig(17,20)
 `[-3, -7, -7, -7, -3, -1, -5, -5, -5, -5, -1, -3, -7, -7, -7, -3]`
list_d(17,19)
 `[213, [0, 0, 0, 0, 0, 2, 4, 2, 0, 0, 0, 0, 0, 0, 2, 2, 0]]`
list_sig(7,9)
 `[-1, -3, -1, -1, -3, -1]`
list_sig(9,11)
 `[-1, -3, -1, 1, 1, -1, -3, -1]`
list_sig(11,13)
 `[-1, -3, -5, -3, -1, -1, -3, -5, -3, -1]`
list_sig(13,15)
 `[-1, -3, -5, -3, -1, 1, 1, -1, -3, -5, -3, -1]`
list_sig(15,17)
 `[-1, -3, -5, -7, -5, -3, -1, -1, -3, -5, -7, -5, -3, -1]`
list_sig(17,19)
 `[-1, -3, -5, -7, -5, -3, -1, 1, 1, -1, -3, -5, -7, -5, -3, -1]`
list_sig(19,21)
 ```[-1, -3, -5, -7, -9, -7, -5, -3, -1, -1, -3, -5, -7, -9, -7, -5, -3, -1]```
list_sig(21,23)
 ```[-1, -3, -5, -7, -9, -7, -5, -3, -1, 1, 1, -1, -3, -5, -7, -9, -7, -5, -3, -1]```
list_sig(7,10)
 `[-3, -3, -5, -5, -3, -3]`
list_sig(11,14)
 `[-3, -3, -3, -1, -5, -5, -1, -3, -3, -3]`
list_sig(13,16)
 `[-3, -3, -3, 1, -1, -5, -5, -1, 1, -3, -3, -3]`
list_sig(17,20)
 `[-3, -7, -7, -7, -3, -1, -5, -5, -5, -5, -1, -3, -7, -7, -7, -3]`
list_sig(19,22)
 ```[-3, -7, -7, -7, -3, 1, -1, -5, -5, -5, -5, -1, 1, -3, -7, -7, -7, -3]```
list_sig(23,26)
 ```[-3, -7, -7, -7, -7, -3, 1, 3, -1, -5, -5, -5, -5, -1, 3, 1, -3, -7, -7, -7, -7, -3]```
list_sig(25,28)
 ```[-3, -7, -11, -11, -11, -11, -7, -3, -5, -9, -13, -13, -13, -13, -9, -5, -3, -7, -11, -11, -11, -11, -7, -3]```
list_sig(29,32)
 ```[-3, -7, -11, -11, -11, -11, -11, -7, -3, -1, -5, -9, -13, -13, -13, -13, -9, -5, -1, -3, -7, -11, -11, -11, -11, -11, -7, -3]```
list_sig(31,34)
 ```[-3, -7, -11, -11, -11, -11, -11, -7, -3, 1, -1, -5, -9, -13, -13, -13, -13, -9, -5, -1, 1, -3, -7, -11, -11, -11, -11, -11, -7, -3]```
list_sig(35,38)
 ```[-3, -7, -11, -15, -15, -15, -15, -15, -11, -7, -3, -1, -5, -9, -13, -13, -13, -13, -13, -13, -9, -5, -1, -3, -7, -11, -15, -15, -15, -15, -15, -11, -7, -3]```
list_sig(37,40)
 ```[-3, -7, -11, -15, -15, -15, -15, -15, -11, -7, -3, 1, -1, -5, -9, -13, -13, -13, -13, -13, -13, -9, -5, -1, 1, -3, -7, -11, -15, -15, -15, -15, -15, -11, -7, -3]```
list_sig(41,44)
 ```[-3, -7, -11, -15, -15, -15, -15, -15, -15, -11, -7, -3, 1, 3, -1, -5, -9, -13, -13, -13, -13, -13, -13, -9, -5, -1, 3, 1, -3, -7, -11, -15, -15, -15, -15, -15, -15, -11, -7, -3]```
list_sig(43,46)
 ```[-3, -7, -11, -15, -19, -19, -19, -19, -19, -19, -15, -11, -7, -3, -5, -9, -13, -17, -21, -21, -21, -21, -21, -21, -17, -13, -9, -5, -3, -7, -11, -15, -19, -19, -19, -19, -19, -19, -15, -11, -7, -3]```
list_sig(47,50)
 ```[-3, -7, -11, -15, -19, -19, -19, -19, -19, -19, -19, -15, -11, -7, -3, -1, -5, -9, -13, -17, -21, -21, -21, -21, -21, -21, -17, -13, -9, -5, -1, -3, -7, -11, -15, -19, -19, -19, -19, -19, -19, -19, -15, -11, -7, -3]```
list_sig(49,52)
 ```[-3, -7, -11, -15, -19, -19, -19, -19, -19, -19, -19, -15, -11, -7, -3, 1, -1, -5, -9, -13, -17, -21, -21, -21, -21, -21, -21, -17, -13, -9, -5, -1, 1, -3, -7, -11, -15, -19, -19, -19, -19, -19, -19, -19, -15, -11, -7, -3]```