JacobiSymbol
The Jacobi symbol (n/m), generalising the Legendre symbol to composite m.
Jacobi symbolMathWorldJacobiSymbolWikidataQ241015Wolfram LanguageJacobiSymbol✓Rosetta CodeJacobi symbolJacobiSymbol(n, m)the Jacobi symbol .jacobi_symbol(n, m)SymPyjacobi_symbol(n, m)Juliajacobi_symbol(ZZ(n), ZZ(m))Typed signatures
| Type | Package | Applies |
|---|---|---|
(integer, integer) -> integer | compute-engine | always |
Details
- Generalizes the Legendre symbol from prime to any odd , by multiplying the Legendre symbols of 's prime factors.
- 0 whenever and share a factor.
- Completely multiplicative in the top argument: .
- By convention for every .
- Unlike the Legendre symbol, doesn't imply is a quadratic residue mod when is composite.
Plot
Examples
Scope #
Properties #
is a square, so the symbol is
live ↗Known value · Wolfram MathematicalFunctionData, JacobiSymbol
A multiple of the modulus gives
live ↗Known value · Wolfram MathematicalFunctionData, JacobiSymbol
is not a square mod 3, since
live ↗Known value · Wolfram MathematicalFunctionData, JacobiSymbol
Zero is never coprime to the modulus, so the symbol vanishes
live ↗Known value · Wolfram MathematicalFunctionData, JacobiSymbol
Shares a factor with the modulus:
live ↗Known value · Wolfram MathematicalFunctionData, JacobiSymbol
A perfect square gives when coprime
live ↗Known value · Wolfram MathematicalFunctionData, JacobiSymbol
Another multiple of 3, another
live ↗Known value · Wolfram MathematicalFunctionData, JacobiSymbol
Every third value in drops to
live ↗Known value · Wolfram MathematicalFunctionData, JacobiSymbol
The pattern repeats with period 3 in
live ↗Known value · Wolfram MathematicalFunctionData, JacobiSymbol
Possible issues #
About
| Examples | 28 |
|---|---|
| Checked against | Wolfram Language 28 agreeSageMath 28 agreeSymPy 28 agreemathlib4 25 agree2 errorJulia 27 agree |
| Crosswalk | WikipediaMathWorldWikidataWolfram LanguageSageMathSymPyJuliaRosetta Code |
Implementation
sympypackages/oracle/src/mappings.tsSymPy's jacobi_symbol raises unless the lower argument is odd and positive.
sagepackages/oracle/src/mappings.tsjuliapackages/oracle/src/mappings.tsmathlib4packages/oracle/src/mappings.tsMathlib's jacobiSym a b is the product of Legendre symbols over the prime factors of b, for any natural b: at an even b the factor at 2 is the quadratic character of ZMod 2, not the Kronecker symbol, so only an odd positive b is comparable.
See also: PowerMod, LegendreSymbol, KroneckerSymbol