[issue40446] pow(a, b, p) where b=int((p-1)/2) spits out gibbrish for big p

2020-04-29 Thread Basic ICT Repairs
Basic ICT Repairs added the comment: Hi, I was calculating Legendre coefficients, and quadratic residues and encountered what I believe to be a bug while using this code: for a in range (5): exp=int((p-1)/2) x=pow(a,exp,p) print(x) If p is an odd prime, then x can

[issue40446] pow(a, b, p) where b=int((p-1)/2) spits out gibbrish for big p

2020-04-29 Thread Basic ICT Repairs
New submission from Basic ICT Repairs : Hi, I was calculating Legendre coefficients, and quadratic residues and encountered what I believe to be a bug while using this code: for a in range (5): exp=int((p-1)/2) x=pow(a,exp,p) print(x) If p is an odd prime, then x can