This site is supported by donations to The OEIS Foundation.

# Jacobi symbol

The Jacobi symbol ${\displaystyle \scriptstyle \left({\frac {n}{m}}\right)\,}$ is a generalization of the Legendre symbol. Given two coprime integers ${\displaystyle m}$ and ${\displaystyle n}$, with the former the product of ${\displaystyle \Omega (m)}$ primes ${\displaystyle p_{i}}$ (not necessarily distinct),[1] the Jacobi symbol is

${\displaystyle \left({\frac {n}{m}}\right)=\prod _{i=1}^{\Omega (m)}\left({\frac {n}{p_{i}}}\right)}$

where ${\displaystyle \left({\frac {n}{p_{i}}}\right)}$ is the Legendre symbol. Here are two examples with ${\displaystyle n=2}$:

${\displaystyle \left({\frac {2}{15}}\right)=\left({\frac {2}{3}}\right)\left({\frac {2}{5}}\right)=(-1)(-1)=1}$
${\displaystyle \left({\frac {2}{45}}\right)=\left({\frac {2}{3}}\right)\left({\frac {2}{3}}\right)\left({\frac {2}{5}}\right)=(-1)(-1)(-1)=-1}$

There is no problem with confusing the Legendre and Jacobi symbols; one has a prime for the second argument, the other a composite. In fact, at least one computer algebra system (Wolfram Mathematica) does not offer a separate LegendreSymbol[a, p] command,[2] instead "overloading" JacobiSymbol[n, m].

However, the notation remains confusing because it looks like a fraction: the examples above could be misunderstood to mean that 2 fifteenths is the same thing as 4 fifteenths and 1, or that 2 forty-fifths is the same thing as 8 forty-fifths and –1.

1. By ${\displaystyle \Omega (n)}$ we're referring to Omega(n), number of prime factors of n (with multiplicity).
2. But one can certainly define it if one feels that strongly about it.