Jacobi Symbol
Return (a/n) for a signed decimal numerator and positive odd decimal denominator, including (a/1)=1; a value of one does not prove a quadratic residue for composite n.
Description
The Jacobi symbol extends Legendre’s prime-modulus symbol to a positive odd denominator.
The Jacobi symbol extends Legendre’s prime-modulus symbol to a positive odd denominator. For composite denominators, a value of one is necessary in some residue settings but does not prove a square residue.1
The tool returns symbol. The indexing and output conventions below determine how to read these values.
When to use Jacobi Symbol
Use this for the following task: Return (a/n) for a signed decimal numerator and positive odd decimal denominator, including (a/1)=1; a value of one does not prove a quadratic residue for composite n. Use the input and output conventions below to reproduce the intended mathematical quantity.
How to use Jacobi Symbol and understand its results
- Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
- Enter numerator, denominator according to the field table, then run the tool.
- Read symbol. Use the stated units, indexing and interpretation of the numerical result.
- Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| numerator | Signed integer numerator | string (integer/arbitrary); maximum text length 200; pattern ^-?(0|[1-9][0-9]*)$ | Required |
| denominator | Positive odd denominator | string (integer/arbitrary); maximum text length 200; pattern ^[1-9][0-9]*$ | Required |
Normalize the signed BigInt numerator, remove powers of two with mod-eight sign changes, swap numerator and denominator with reciprocity signs, and reduce until termination.
(a/n) from removal of powers of two and quadratic reciprocity; (a/1)=1 The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| symbol | Jacobi symbol | integer |
{
"input": {
"numerator": "5",
"denominator": "21"
},
"output": {
"symbol": 1
}
} Limitations and assumptions
The denominator must be positive and odd. Each input is capped at 200 characters; use Kronecker for even, negative or zero denominators.
Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.
Alternative or Complementary methods
Choose Legendre Symbol when you need its operation: Return the Legendre symbol (a/p) for a signed decimal integer and an odd prime p, using Euler’s criterion and trial primality testing limited to p≤10¹². Choose Kronecker Symbol for the complementary operation: Extend the Jacobi symbol to signed decimal denominators, including factors of two, negative denominators, and (a/0)=1 exactly when |a|=1.
Background reference: Arithmetic functions: jacobi symbol.
References
-
Arithmetic functions: jacobi symbol — SageMath developers
Similar or alternative tools
- Legendre Symbol
Return the Legendre symbol (a/p) for a signed decimal integer and an odd prime p, using Euler’s criterion and trial primality testing limited to p≤10¹².
- Kronecker Symbol
Extend the Jacobi symbol to signed decimal denominators, including factors of two, negative denominators, and (a/0)=1 exactly when |a|=1.