# Legendre–Jacobi–Kronecker symbol

A generalisation of the Jacobi symbol $\left(\frac{a}{b}\right)$ to arbitrary integers $a$, $b$. If $b=0$, it is defined as 1 if $a = \pm 1$ and 0 otherwise. For $b \neq 0$, write $b$ as a product $\prod_i p_i$ where the $p_i$ are primes, not necessarily distinct, or $-1$. Then $$\left({\frac{a}{b}}\right) = \prod_i \left({\frac{a}{p_i}}\right)$$ where $\left(\frac{a}{p}\right)$ is the Legendre symbol when $p$ is an odd prime; $$\left({\frac{a}{2}}\right) = \begin{cases}0,&a\ \text{even},\\(-1)^{(a^2-1)/8},&a\ \text{odd}.\end{cases}$$ $$\left({\frac{a}{-1}}\right) = \begin{cases}1,&a \ge 0,\\(-1),&a < 0.\end{cases}$$