How to use this calculator
Find both square roots of a quadratic residue modulo an odd prime, or show that none exists.
- Enter Integer residue, Odd prime modulus. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Square roots modulo an odd prime explained
A numerical walkthrough
Integer residue = 10; Odd prime modulus = 13.
- Modular square roots: 6, 7
The model behind the numbers
Tonelli–Shanks modular square root
Modulus is tested by trial division within the entered billion limit; composite moduli are rejected..
What to enter
a— Integer residue- Integer residue. Enter a whole number.
p— Odd prime modulus- Odd prime modulus. Enter a whole number.
Interpreting the result
Modulus is tested by trial division within the entered billion limit; composite moduli are rejected.
Assumptions and limits
The method is for an odd prime modulus. A residue may have no square root; composite moduli require different handling, and the modulus p = 2 is outside this page’s stated domain.
Frequently asked questions
Why require a prime?
The algorithm relies on arithmetic in a prime field.
Can zero have one root?
Yes, only zero modulo a prime.
Does every number have a root?
No, nonresidues have none.
How do I use the Square roots modulo an odd prime calculator?
Enter Integer residue, Odd prime modulus. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Square roots modulo an odd prime?
Integer residue = 10; Odd prime modulus = 13. Modular square roots: 6, 7
Read our calculation methodology.