Legendre Symbol Calculator

(a/p) = a^((p−1)/2) mod p

CalculatorsFreeNo Signup
4.4(657 reviews)
All Tools

Loading tool...

About Legendre Symbol Calculator

A Legendre symbol calculator computing (a/p) for prime p: 1 if a is a quadratic residue mod p, −1 if not, 0 if p|a. Uses Euler's criterion a^((p−1)/2) mod p. Shows computation steps. All calculations are client-side.

Legendre Symbol Calculator Features

  • (a/p)
  • Euler criterion
  • QR list
  • Reciprocity
  • Table
Legendre symbol (a/p): 1 if a≡x² (mod p) for some x (quadratic residue), −1 if not (non-residue), 0 if p|a. Euler's criterion: (a/p) ≡ a^((p−1)/2) (mod p). Quadratic reciprocity: (p/q)(q/p) = (−1)^((p−1)/2·(q−1)/2).

How to Use

Enter a and prime p:

  • (a/p): 1, −1, or 0
  • Euler: a^((p−1)/2) mod p
  • QR list: All residues mod p

Quadratic Reciprocity

For odd primes p≠q: (p/q)(q/p) = (−1)^((p−1)(q−1)/4). Supplements: (−1/p) = (−1)^((p−1)/2), (2/p) = (−1)^((p²−1)/8). Gauss called this the 'golden theorem.'

Applications

  • Solving quadratic congruences
  • Primality testing
  • Cryptography (Goldwasser-Micali)
  • Algebraic number theory

Step-by-Step Instructions

  1. 1Enter a.
  2. 2Enter prime p.
  3. 3Get (a/p).
  4. 4View Euler computation.
  5. 5See QR list.

Legendre Symbol Calculator — Frequently Asked Questions

What is Euler's criterion?+

(a/p) ≡ a^((p−1)/2) (mod p). This works because the multiplicative group mod p is cyclic of order p−1. If a=g^k, then a^((p−1)/2) = g^(k(p−1)/2) = 1 iff k is even (i.e., a is a square).

Why is quadratic reciprocity important?+

It lets you 'flip' (p/q) to (q/p), reducing large Legendre symbols to smaller ones. Gauss gave 6 proofs. It's the simplest case of Artin reciprocity in class field theory — one of the deepest results in mathematics.

How many quadratic residues are there mod p?+

Exactly (p−1)/2 non-zero quadratic residues and (p−1)/2 non-residues mod an odd prime p. This is because squaring is a 2-to-1 map on the multiplicative group mod p (since x² = (−x)²).

Share this tool: