79309489

Date: 2024-12-26 12:38:29
Score: 1.5
Natty:
Report link

Standard definition of Legendre symbol (a|b) requires that b is an odd prime. The generalization is the Kronecker symbol defined for integers b!=0:

(a|b)=Product((a|p)) where p is a prime factorization including 2 and -1 and (a|p) is the Legendre symbol. But we need these definitions:

(a|2)={0 if a is even (-1)^((a^2-1)/8) if a is odd

(a|-1)={1 if a>=0 else -1 if a<0

Note: there’s a more efficient way to calculate (-1)^((a^2-1)/8).

Lookup a mod 8 in the following table:

[0,1,0,-1,0,-1,0,1]

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Cam Rose