Jacobi/Legendre symbol with deterministic Miller–Rabin primality, Tonelli–Shanks square roots for prime moduli, and brute-force resolution for small composite moduli.
Execution
Run this tool
Fill in the form, run the tool, and review the result in one place.
Samples
Examples that match this tool
Related
Continue with connected tools and hubs
Tool usage guide
Learn when to use this tool, what it supports, and how real users apply it.
Key facts
Category
Math & Numbers
Input types
text, checkbox
Output type
text
Sample coverage
4
API ready
Yes
Overview
The Quadratic Residue Checker evaluates whether an integer is a quadratic residue modulo an odd integer using the Legendre or Jacobi symbol, deterministic Miller–Rabin primality testing, and the Tonelli–Shanks algorithm to extract modular square roots.
When to use
Determining if a modular congruence x² ≡ a (mod n) has integer solutions.
Computing modular square roots for prime moduli in cryptography or number theory tasks.
Evaluating Legendre and Jacobi symbols to analyze residues and non-residues.
How it works
1Enter the target value a (reduced modulo n) and an odd modulus n between 3 and 10¹⁸.
2The tool performs deterministic Miller–Rabin primality testing on n and evaluates the Jacobi or Legendre symbol (a/n).
3For prime moduli with a symbol of +1, Tonelli–Shanks computes the square roots when requested, while small composite moduli (n ≤ 100,000) are resolved via exhaustive search.
Use cases
Solving quadratic congruences in cryptography implementations like Rabin cryptosystems or elliptic curve point decompression.
Verifying theoretical homework problems in abstract algebra and elementary number theory courses.
Analyzing pseudo-squares and composite modulus behavior in computational mathematics research.
Examples
1. Solving square roots modulo a prime
Cryptography student
Background
Studying modular square roots for elliptic curve point recovery over prime fields.
Problem
Check if 10 is a square modulo 13 and find the roots satisfying x² ≡ 10 (mod 13).
How to use
Set Value a to 10, Modulus n to 13, and check the option to solve roots.
Outcome
Confirms (10/13) = 1 and outputs the verified roots x = 6 and x = 7.
2. Resolving an inconclusive Jacobi symbol on a composite modulus
Mathematics researcher
Background
Testing properties of composite integers where quadratic character evaluation can yield false positives.
Problem
Determine if 2 is a quadratic residue modulo 15 despite Jacobi(2/15) returning +1.
How to use
Input 2 for Value a, 15 for Modulus n, and run the calculation.
Outcome
Calculates Jacobi(2/15) = 1 and uses brute-force inspection to prove x² ≡ 2 (mod 15) has no solution.
FAQ
What is the difference between the Legendre and Jacobi symbols?
The Legendre symbol applies strictly to odd prime moduli, while the Jacobi symbol extends this notation to odd composite moduli as a product of Legendre symbols.
Does a Jacobi symbol of +1 guarantee that a is a quadratic residue?
No. For composite moduli, a Jacobi symbol of +1 is inconclusive; for values of n ≤ 100,000, the tool runs a brute-force scan to confirm actual solvability.
What algorithms are used to solve the modular square roots?
When n is prime, the tool employs the Tonelli–Shanks algorithm (or direct exponentiation when n ≡ 3 mod 4) to output the square roots.
What limits apply to inputs a and n?
The modulus n must be an odd integer up to 10¹⁸, and the integer a is accepted up to 10⁵¹² before being reduced modulo n.
How is primality of modulus n verified?
The tool uses deterministic Miller–Rabin testing to verify primality without probabilistic error for 64-bit moduli.