I’m computing Jacobi sum of cubic residue symbol as follows:
N=3
x=polygen(ZZ,'x')
K.<z>=CyclotomicField(N)
p=-4-3*z
P = K.ideal(p)
sum([K(a).residue_symbol(P,N)*K(1-a).residue_symbol(P,N) for a in [2..P.norm()-1] if a not in P and 1-a not in P])
The output is -3*z - 4
. This is correct.
But I wrote another equivalent code:
def Jacobi(P,l,j):
x=sum([K(a).residue_symbol(P,l)^j*K(1-a).residue_symbol(P,l)^j for a in range(2, P.norm()-1) if a not in P and 1-a not in P])
return x
N=3
x=polygen(ZZ,'x')
K.<z>=CyclotomicField(N)
p=-4-3*z
P = K.ideal(p)
Jacobi(P,N,1)
Then the output is -4*z - 4
, this is odd. Where is wrong?