Template:Short description Template:Pp-sock In number theory, an integer q is a quadratic residue modulo n if it is congruent to a perfect square modulo n; that is, if there exists an integer x such that
- <math>x^2\equiv q \pmod{n}.</math>
Otherwise, q is a quadratic nonresidue modulo n.
Quadratic residues are used in applications ranging from acoustical engineering to cryptography and the factoring of large numbers.
History, conventions, and elementary factsEdit
Fermat, Euler, Lagrange, Legendre, and other number theorists of the 17th and 18th centuries established theorems<ref>Lemmemeyer, Ch. 1</ref> and formed conjectures<ref>Lemmermeyer, pp 6–8, p. 16 ff</ref> about quadratic residues, but the first systematic treatment is § IV of Gauss's Disquisitiones Arithmeticae (1801). Article 95 introduces the terminology "quadratic residue" and "quadratic nonresidue", and says that if the context makes it clear, the adjective "quadratic" may be dropped.
For a given n, a list of the quadratic residues modulo n may be obtained by simply squaring all the numbers 0, 1, ..., Template:Nowrap. Since a≡b (mod n) implies a2≡b2 (mod n), any other quadratic residue is congruent (mod n) to some in the obtained list. But the obtained list is not composed of mutually incongruent quadratic residues (mod n) only. Since a2≡(n−a)2 (mod n), the list obtained by squaring all numbers in the list 1, 2, ..., Template:Nowrap (or in the list 0, 1, ..., n) is symmetric (mod n) around its midpoint, hence it is actually only needed to square all the numbers in the list 0, 1, ..., <math>\lfloor</math> n/2 <math>\rfloor</math>. The list so obtained may still contain mutually congruent numbers (mod n). Thus, the number of mutually noncongruent quadratic residues modulo n cannot exceed n/2 + 1 (n even) or (n + 1)/2 (n odd).<ref>Gauss, DA, art. 94</ref>
The product of two residues is always a residue.
Prime modulusEdit
Modulo 2, every integer is a quadratic residue.
Modulo an odd prime number p there are (p + 1)/2 residues (including 0) and (p − 1)/2 nonresidues, by Euler's criterion. In this case, it is customary to consider 0 as a special case and work within the multiplicative group of nonzero elements of the field <math>(\mathbb{Z}/p\mathbb{Z})</math>. In other words, every congruence class except zero modulo p has a multiplicative inverse. This is not true for composite moduli.<ref name="Gauss, DA, art. 96">Gauss, DA, art. 96</ref>
Following this convention, the multiplicative inverse of a residue is a residue, and the inverse of a nonresidue is a nonresidue.<ref name="Gauss, DA, art. 98">Gauss, DA, art. 98</ref>
Following this convention, modulo an odd prime number there is an equal number of residues and nonresidues.<ref name="Gauss, DA, art. 96"/>
Modulo a prime, the product of two nonresidues is a residue and the product of a nonresidue and a (nonzero) residue is a nonresidue.<ref name="Gauss, DA, art. 98"/>
The first supplement<ref>Gauss, DA, art 111</ref> to the law of quadratic reciprocity is that if p ≡ 1 (mod 4) then −1 is a quadratic residue modulo p, and if p ≡ 3 (mod 4) then −1 is a nonresidue modulo p. This implies the following:
If p ≡ 1 (mod 4) the negative of a residue modulo p is a residue and the negative of a nonresidue is a nonresidue.
If p ≡ 3 (mod 4) the negative of a residue modulo p is a nonresidue and the negative of a nonresidue is a residue.
Prime power modulusEdit
All odd squares are ≡ 1 (mod 8) and thus also ≡ 1 (mod 4). If a is an odd number and m = 8, 16, or some higher power of 2, then a is a residue modulo m if and only if a ≡ 1 (mod 8).<ref>Gauss, DA, art. 103</ref>
For example, mod (32) the odd squares are
- 12 ≡ 152 ≡ 1
- 32 ≡ 132 ≡ 9
- 52 ≡ 112 ≡ 25
- 72 ≡ 92 ≡ 49 ≡ 17
and the even ones are
- 02 ≡ 82 ≡ 162 ≡ 0
- 22 ≡ 62≡ 102 ≡ 142≡ 4
- 42 ≡ 122 ≡ 16.
So a nonzero number is a residue mod 8, 16, etc., if and only if it is of the form 4k(8n + 1).
A number a relatively prime to an odd prime p is a residue modulo any power of p if and only if it is a residue modulo p.<ref name="Gauss, DA, art. 101">Gauss, DA, art. 101</ref>
If the modulus is pn,
- then pka
- is a residue modulo pn if k ≥ n
- is a nonresidue modulo pn if k < n is odd
- is a residue modulo pn if k < n is even and a is a residue
- is a nonresidue modulo pn if k < n is even and a is a nonresidue.<ref>Gauss, DA, art. 102</ref>
Notice that the rules are different for powers of two and powers of odd primes.
Modulo an odd prime power n = pk, the products of residues and nonresidues relatively prime to p obey the same rules as they do mod p; p is a nonresidue, and in general all the residues and nonresidues obey the same rules, except that the products will be zero if the power of p in the product ≥ n.
Modulo 8, the product of the nonresidues 3 and 5 is the nonresidue 7, and likewise for permutations of 3, 5 and 7. In fact, the multiplicative group of the non-residues and 1 form the Klein four-group.
Composite modulus not a prime powerEdit
The basic fact in this case is
- if a is a residue modulo n, then a is a residue modulo pk for every prime power dividing n.
- if a is a nonresidue modulo n, then a is a nonresidue modulo pk for at least one prime power dividing n.
Modulo a composite number, the product of two residues is a residue. The product of a residue and a nonresidue may be a residue, a nonresidue, or zero.
For example, from the table for modulus 6 1, 2, 3, 4, 5 (residues in bold).
The product of the residue 3 and the nonresidue 5 is the residue 3, whereas the product of the residue 4 and the nonresidue 2 is the nonresidue 2.
Also, the product of two nonresidues may be either a residue, a nonresidue, or zero.
For example, from the table for modulus 15 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 (residues in bold).
The product of the nonresidues 2 and 8 is the residue 1, whereas the product of the nonresidues 2 and 7 is the nonresidue 14.
This phenomenon can best be described using the vocabulary of abstract algebra. The congruence classes relatively prime to the modulus are a group under multiplication, called the group of units of the ring <math>(\mathbb{Z}/n\mathbb{Z})</math>, and the squares are a subgroup of it. Different nonresidues may belong to different cosets, and there is no simple rule that predicts which one their product will be in. Modulo a prime, there is only the subgroup of squares and a single coset.
The fact that, e.g., modulo 15 the product of the nonresidues 3 and 5, or of the nonresidue 5 and the residue 9, or the two residues 9 and 10 are all zero comes from working in the full ring <math>(\mathbb{Z}/n\mathbb{Z})</math>, which has zero divisors for composite n.
For this reason some authors<ref>e.g., Template:Harvnb</ref> add to the definition that a quadratic residue a must not only be a square but must also be relatively prime to the modulus n. (a is coprime to n if and only if a2 is coprime to n.)
Although it makes things tidier, this article does not insist that residues must be coprime to the modulus.
NotationsEdit
Gauss<ref>Gauss, DA, art. 131</ref> used Template:Math and Template:Math to denote residuosity and non-residuosity, respectively;
- for example, Template:Math and Template:Math, or Template:Math and Template:Math.
Although this notation is compact and convenient for some purposes,<ref>e.g. Hardy and Wright use it</ref><ref>Gauss, DA, art 230 ff.</ref> a more useful notation is the Legendre symbol, also called the quadratic character, which is defined for all integers Template:Mvar and positive odd prime numbers Template:Mvar as
- <math>
\left(\frac{a}{p}\right) = \begin{cases}\;\;\,0&\text{ if }p \text { divides } a\\+1&\text{ if } a \operatorname{R} p \text{ and }p \text { does not divide } a\\-1&\text{ if }a \operatorname{N} p \text{ and }p \text{ does not divide } a\end{cases}</math>
There are two reasons why numbers ≡ 0 (mod Template:Mvar) are treated specially. As we have seen, it makes many formulas and theorems easier to state. The other (related) reason is that the quadratic character is a homomorphism from the [[multiplicative group of integers modulo n|multiplicative group of nonzero congruence classes modulo Template:Mvar]] to the complex numbers under multiplication. Setting <math>(\tfrac{np}{p}) = 0</math> allows its domain to be extended to the multiplicative semigroup of all the integers.<ref>This extension of the domain is necessary for defining L functions.</ref>
One advantage of this notation over Gauss's is that the Legendre symbol is a function that can be used in formulas.<ref>See Legendre symbol#Properties of the Legendre symbol for examples</ref> It can also easily be generalized to cubic, quartic and higher power residues.<ref>Lemmermeyer, pp 111–end</ref>
There is a generalization of the Legendre symbol for composite values of Template:Mvar, the Jacobi symbol, but its properties are not as simple: if Template:Mvar is composite and the Jacobi symbol <math>(\tfrac{a}{m}) = -1,</math> then Template:Math, and if Template:Math then <math>(\tfrac{a}{m}) = 1,</math> but if <math>(\tfrac{a}{m}) = 1</math> we do not know whether Template:Math or Template:Math. For example: <math>(\tfrac{2}{15}) = 1</math> and <math>(\tfrac{4}{15}) = 1</math>, but Template:Math and Template:Math. If Template:Mvar is prime, the Jacobi and Legendre symbols agree.
Distribution of quadratic residuesEdit
Although quadratic residues appear to occur in a rather random pattern modulo n, and this has been exploited in such applications as acoustics and cryptography, their distribution also exhibits some striking regularities.
Using Dirichlet's theorem on primes in arithmetic progressions, the law of quadratic reciprocity, and the Chinese remainder theorem (CRT) it is easy to see that for any M > 0 there are primes p such that the numbers 1, 2, ..., M are all residues modulo p.
For example, if p ≡ 1 (mod 8), (mod 12), (mod 5) and (mod 28), then by the law of quadratic reciprocity 2, 3, 5, and 7 will all be residues modulo p, and thus all numbers 1–10 will be. The CRT says that this is the same as p ≡ 1 (mod 840), and Dirichlet's theorem says there are an infinite number of primes of this form. 2521 is the smallest, and indeed 12 ≡ 1, 10462 ≡ 2, 1232 ≡ 3, 22 ≡ 4, 6432 ≡ 5, 872 ≡ 6, 6682 ≡ 7, 4292 ≡ 8, 32 ≡ 9, and 5292 ≡ 10 (mod 2521).
Dirichlet's formulasEdit
The first of these regularities stems from Peter Gustav Lejeune Dirichlet's work (in the 1830s) on the analytic formula for the class number of binary quadratic forms.<ref>Template:Harvnb. These are classical results.</ref> Let q be a prime number, s a complex variable, and define a Dirichlet L-function as
- <math>L(s) = \sum_{n=1}^\infty\left(\frac{n}{q}\right)n^{-s}. </math>
Dirichlet showed that if q ≡ 3 (mod 4), then
- <math>L(1) = -\frac{\pi}{\sqrt q}\sum_{n=1}^{q-1} \frac{n}{q} \left(\frac{n}{q}\right) > 0.</math>
Therefore, in this case (prime q ≡ 3 (mod 4)), the sum of the quadratic residues minus the sum of the nonresidues in the range 1, 2, ..., q − 1 is a negative number.
For example, modulo 11,
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 (residues in bold)
- 1 + 4 + 9 + 5 + 3 = 22, 2 + 6 + 7 + 8 + 10 = 33, and the difference is −11.
In fact the difference will always be an odd multiple of q if q > 3.<ref>Template:Harvnb, (conjectured by Jacobi, proved by Dirichlet)</ref> In contrast, for prime q ≡ 1 (mod 4), the sum of the quadratic residues minus the sum of the nonresidues in the range 1, 2, ..., q − 1 is zero, implying that both sums equal <math>\frac{q(q-1)}{4}</math>.Template:Cn
Dirichlet also proved that for prime q ≡ 3 (mod 4),
- <math>L(1) = \frac{\pi}{\left(2-\left(\frac{2}{q}\right)\right)\!\sqrt q}\sum_{n=1}^\frac{q-1}{2}\left(\frac{n}{q}\right) > 0.</math>
This implies that there are more quadratic residues than nonresidues among the numbers 1, 2, ..., (q − 1)/2.
For example, modulo 11 there are four residues less than 6 (namely 1, 3, 4, and 5), but only one nonresidue (2).
An intriguing fact about these two theorems is that all known proofs rely on analysis; no-one has ever published a simple or direct proof of either statement.<ref>Template:Harvnb</ref>
Law of quadratic reciprocityEdit
{{#invoke:Labelled list hatnote|labelledList|Main article|Main articles|Main page|Main pages}}
If p and q are odd primes, then:
((p is a quadratic residue mod q) if and only if (q is a quadratic residue mod p)) if and only if (at least one of p and q is congruent to 1 mod 4).
That is:
- <math> \left(\frac{p}{q}\right) \left(\frac{q}{p}\right) = (-1)^{\frac{p-1}{2} \cdot \frac{q-1}{2}}</math>
where <math>\left(\frac{p}{q}\right)</math> is the Legendre symbol.
Thus, for numbers a and odd primes p that don't divide a:
a | a is a quadratic residue mod p if and only if | a | a is a quadratic residue mod p if and only if |
---|---|---|---|
1 | (every prime p) | −1 | p ≡ 1 (mod 4) |
2 | p ≡ 1, 7 (mod 8) | −2 | p ≡ 1, 3 (mod 8) |
3 | p ≡ 1, 11 (mod 12) | −3 | p ≡ 1 (mod 3) |
4 | (every prime p) | −4 | p ≡ 1 (mod 4) |
5 | p ≡ 1, 4 (mod 5) | −5 | p ≡ 1, 3, 7, 9 (mod 20) |
6 | p ≡ 1, 5, 19, 23 (mod 24) | −6 | p ≡ 1, 5, 7, 11 (mod 24) |
7 | p ≡ 1, 3, 9, 19, 25, 27 (mod 28) | −7 | p ≡ 1, 2, 4 (mod 7) |
8 | p ≡ 1, 7 (mod 8) | −8 | p ≡ 1, 3 (mod 8) |
9 | (every prime p) | −9 | p ≡ 1 (mod 4) |
10 | p ≡ 1, 3, 9, 13, 27, 31, 37, 39 (mod 40) | −10 | p ≡ 1, 7, 9, 11, 13, 19, 23, 37 (mod 40) |
11 | p ≡ 1, 5, 7, 9, 19, 25, 35, 37, 39, 43 (mod 44) | −11 | p ≡ 1, 3, 4, 5, 9 (mod 11) |
12 | p ≡ 1, 11 (mod 12) | −12 | p ≡ 1 (mod 3) |
Pairs of residues and nonresiduesEdit
Modulo a prime p, the number of pairs n, n + 1 where n R p and n + 1 R p, or n N p and n + 1 R p, etc., are almost equal. More precisely,<ref>Lemmermeyer, p. 29 ex. 1.22; cf pp. 26–27, Ch. 10</ref><ref>Crandall & Pomerance, ex 2.38, pp 106–108</ref> let p be an odd prime. For i, j = 0, 1 define the sets
- <math>A_{ij}=\left\{k\in\{1,2,\dots,p-2\}: \left(\frac{k}{p}\right)=(-1)^i\land\left(\frac{k+1}{p}\right)=(-1)^j\right\},</math>
and let
- <math>\alpha_{ij} = |A_{ij}|.</math>
That is,
- α00 is the number of residues that are followed by a residue,
- α01 is the number of residues that are followed by a nonresidue,
- α10 is the number of nonresidues that are followed by a residue, and
- α11 is the number of nonresidues that are followed by a nonresidue.
Then if p ≡ 1 (mod 4)
- <math>\alpha_{00} = \frac{p-5}{4},\;\alpha_{01} =\alpha_{10} =\alpha_{11} = \frac{p-1}{4} </math>
and if p ≡ 3 (mod 4)
- <math>\alpha_{01} = \frac{p+1}{4},\;\alpha_{00} =\alpha_{10} =\alpha_{11} = \frac{p-3}{4}. </math>
For example: (residues in bold)
Modulo 17
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
- A00 = {1,8,15},
- A01 = {2,4,9,13},
- A10 = {3,7,12,14},
- A11 = {5,6,10,11}.
Modulo 19
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
- A00 = {4,5,6,16},
- A01 = {1,7,9,11,17},
- A10 = {3,8,10,15},
- A11 = {2,12,13,14}.
Gauss (1828)<ref>Gauss, Theorie der biquadratischen Reste, Erste Abhandlung (pp 511–533 of the Untersuchungen über hohere Arithmetik)</ref> introduced this sort of counting when he proved that if p ≡ 1 (mod 4) then x4 ≡ 2 (mod p) can be solved if and only if p = a2 + 64 b2.
The Pólya–Vinogradov inequalityEdit
The values of <math>(\tfrac{a}{p})</math> for consecutive values of a mimic a random variable like a coin flip.<ref>Crandall & Pomerance, ex 2.38, pp 106–108 discuss the similarities and differences. For example, tossing n coins, it is possible (though unlikely) to get n/2 heads followed by that many tails. V-P inequality rules that out for residues.</ref> Specifically, Pólya and Vinogradov proved<ref>Template:Harvnb, (proof of P–V, (in fact big-O can be replaced by 2); journal references for Paley, Montgomery, and Schur)</ref> (independently) in 1918 that for any nonprincipal Dirichlet character χ(n) modulo q and any integers M and N,
- <math>\left|\sum_{n=M+1}^{M+N}\chi(n)\right| =O\left( \sqrt q \log q\right),</math>
in big O notation. Setting
- <math> \chi(n) = \left(\frac{n}{q}\right),</math>
this shows that the number of quadratic residues modulo q in any interval of length N is
- <math>\frac{1}{2}N + O(\sqrt q\log q).</math>
It is easy<ref>Planet Math: Proof of Pólya–Vinogradov Inequality in external links. The proof is a page long and only requires elementary facts about Gaussian sums</ref> to prove that
- <math> \left| \sum_{n=M+1}^{M+N} \left( \frac{n}{q} \right) \right| < \sqrt q \log q.</math>
In fact,<ref>Pomerance & Crandall, ex 2.38 pp.106–108. result from T. Cochrane, "On a trigonometric inequality of Vinogradov", J. Number Theory, 27:9–16, 1987</ref>
- <math> \left| \sum_{n=M+1}^{M+N} \left( \frac{n}{q} \right) \right| < \frac{4}{\pi^2} \sqrt q \log q+0.41\sqrt q +0.61.</math>
Montgomery and Vaughan improved this in 1977, showing that, if the generalized Riemann hypothesis is true then
- <math>\left|\sum_{n=M+1}^{M+N}\chi(n)\right|=O\left(\sqrt q \log \log q\right).</math>
This result cannot be substantially improved, for Schur had proved in 1918 that
- <math>\max_N \left|\sum_{n=1}^{N}\left(\frac{n}{q}\right)\right|>\frac{1}{2\pi}\sqrt q</math>
and Paley had proved in 1932 that
- <math>\max_N \left|\sum_{n=1}^{N}\left(\frac{d}{n}\right)\right|>\frac{1}{7}\sqrt d \log \log d</math>
for infinitely many d > 0.
Least quadratic non-residueEdit
The least quadratic residue mod p is clearly 1. The question of the magnitude of the least quadratic non-residue n(p) is more subtle, but it is always prime, with 7 appearing for the first time at 71.
The Pólya–Vinogradov inequality above gives O(Template:Radic log p).
The best unconditional estimate is n(p) ≪ pθ for any θ>1/4Template:Radic, obtained by estimates of Burgess on character sums.<ref name=FI156/>
Assuming the Generalised Riemann hypothesis, Ankeny obtained n(p) ≪ (log p)2.<ref>Template:Cite book</ref>
Linnik showed that the number of p less than X such that n(p) > Xε is bounded by a constant depending on ε.<ref name=FI156>Template:Cite book</ref>
The least quadratic non-residues mod p for odd primes p are:
Quadratic excessEdit
Let p be an odd prime. The quadratic excess E(p) is the number of quadratic residues on the range (0,p/2) minus the number in the range (p/2,p) (sequence A178153 in the OEIS). For p congruent to 1 mod 4, the excess is zero, since −1 is a quadratic residue and the residues are symmetric under r ↔ p−r. For p congruent to 3 mod 4, the excess E is always positive.<ref>Template:Cite book</ref>
Complexity of finding square rootsEdit
That is, given a number a and a modulus n, how hard is it
- to tell whether an x solving x2 ≡ a (mod n) exists
- assuming one does exist, to calculate it?
An important difference between prime and composite moduli shows up here. Modulo a prime p, a quadratic residue a has 1 + (a|p) roots (i.e. zero if a N p, one if a ≡ 0 (mod p), or two if a R p and gcd(a,p) = 1.)
In general if a composite modulus n is written as a product of powers of distinct primes, and there are n1 roots modulo the first one, n2 mod the second, ..., there will be n1n2... roots modulo n.
The theoretical way solutions modulo the prime powers are combined to make solutions modulo n is called the Chinese remainder theorem; it can be implemented with an efficient algorithm.<ref>Template:Harvnb; it requires O(log2 m) steps where m is the number of primes dividing n.</ref>
For example:
- Solve x2 ≡ 6 (mod 15).
- x2 ≡ 6 (mod 3) has one solution, 0; x2 ≡ 6 (mod 5) has two, 1 and 4.
- and there are two solutions modulo 15, namely 6 and 9.
- Solve x2 ≡ 4 (mod 15).
- x2 ≡ 4 (mod 3) has two solutions, 1 and 2; x2 ≡ 4 (mod 5) has two, 2 and 3.
- and there are four solutions modulo 15, namely 2, 7, 8, and 13.
- Solve x2 ≡ 7 (mod 15).
- x2 ≡ 7 (mod 3) has two solutions, 1 and 2; x2 ≡ 7 (mod 5) has no solutions.
- and there are no solutions modulo 15.
Prime or prime power modulusEdit
First off, if the modulus n is prime the Legendre symbol <math>\left(\frac{a}{n}\right)</math> can be quickly computed using a variation of Euclid's algorithm<ref>Template:Harvnb; computing <math>\left(\frac{a}{n}\right)</math> requires O(log a log n) steps</ref> or the Euler's criterion. If it is −1 there is no solution. Secondly, assuming that <math>\left(\frac{a}{n}\right)=1</math>, if n ≡ 3 (mod 4), Lagrange found that the solutions are given by
- <math>x \equiv \pm\; a^{(n+1)/4} \pmod{n},</math>
and Legendre found a similar solution<ref>Lemmermeyer, p. 29</ref> if n ≡ 5 (mod 8):
- <math>x \equiv \begin{cases}
\pm\; a^{(n+3)/8} \pmod{n}& \text{ if } a \text{ is a quartic residue modulo } n \\ \pm\; a^{(n+3)/8}2^{(n-1)/4} \pmod{n}& \text{ if } a \text{ is a quartic non-residue modulo } n \end{cases}</math>
For prime n ≡ 1 (mod 8), however, there is no known formula. Tonelli<ref>Template:Harvnb; the algorithm requires O(log4n) steps.</ref> (in 1891) and Cipolla<ref>Template:Harvnb; the algorithm requires O(log3 n) steps and is also nondeterministic.</ref> found efficient algorithms that work for all prime moduli. Both algorithms require finding a quadratic nonresidue modulo n, and there is no efficient deterministic algorithm known for doing that. But since half the numbers between 1 and n are nonresidues, picking numbers x at random and calculating the Legendre symbol <math>\left(\frac{x}{n}\right)</math> until a nonresidue is found will quickly produce one. A slight variant of this algorithm is the Tonelli–Shanks algorithm.
If the modulus n is a prime power n = pe, a solution may be found modulo p and "lifted" to a solution modulo n using Hensel's lemma or an algorithm of Gauss.<ref name="Gauss, DA, art. 101"/>
Composite modulusEdit
If the modulus n has been factored into prime powers the solution was discussed above.
If n is not congruent to 2 modulo 4 and the Kronecker symbol <math>\left(\tfrac{a}{n}\right)=-1</math> then there is no solution; if n is congruent to 2 modulo 4 and <math>\left(\tfrac{a}{n/2}\right)=-1</math>, then there is also no solution. If n is not congruent to 2 modulo 4 and <math>\left(\tfrac{a}{n}\right)=1</math>, or n is congruent to 2 modulo 4 and <math>\left(\tfrac{a}{n/2}\right)=1</math>, there may or may not be one.
If the complete factorization of n is not known, and <math>\left(\tfrac{a}{n}\right)=1</math> and n is not congruent to 2 modulo 4, or n is congruent to 2 modulo 4 and <math>\left(\tfrac{a}{n/2}\right)=1</math>, the problem is known to be equivalent to integer factorization of n (i.e. an efficient solution to either problem could be used to solve the other efficiently).
The above discussion indicates how knowing the factors of n allows us to find the roots efficiently. Say there were an efficient algorithm for finding square roots modulo a composite number. The article congruence of squares discusses how finding two numbers x and y where Template:Math and Template:Math suffices to factorize n efficiently. Generate a random number, square it modulo n, and have the efficient square root algorithm find a root. Repeat until it returns a number not equal to the one we originally squared (or its negative modulo n), then follow the algorithm described in congruence of squares. The efficiency of the factoring algorithm depends on the exact characteristics of the root-finder (e.g. does it return all roots? just the smallest one? a random one?), but it will be efficient.<ref>Crandall & Pomerance, ex. 6.5 & 6.6, p.273</ref>
Determining whether a is a quadratic residue or nonresidue modulo n (denoted Template:Math or Template:Math) can be done efficiently for prime n by computing the Legendre symbol. However, for composite n, this forms the quadratic residuosity problem, which is not known to be as hard as factorization, but is assumed to be quite hard.
On the other hand, if we want to know if there is a solution for x less than some given limit c, this problem is NP-complete;<ref>Template:Harvnb</ref> however, this is a fixed-parameter tractable problem, where c is the parameter.
In general, to determine if a is a quadratic residue modulo composite n, one can use the following theorem:<ref>Template:Cite book</ref>
Let Template:Math, and Template:Math. Then Template:Math is solvable if and only if:
- The Legendre symbol <math>\left(\tfrac{a}{p}\right)=1</math> for all odd prime divisors p of n.
- Template:Math if n is divisible by 4 but not 8; or Template:Math if n is divisible by 8.
Note: This theorem essentially requires that the factorization of n is known. Also notice that if Template:Math, then the congruence can be reduced to Template:Math, but then this takes the problem away from quadratic residues (unless m is a square).
The number of quadratic residuesEdit
The list of the number of quadratic residues modulo n, for n = 1, 2, 3 ..., looks like:
A formula to count the number of squares modulo n is given by Stangl.<ref>Template:Citation</ref>
Applications of quadratic residuesEdit
AcousticsEdit
Sound diffusers have been based on number-theoretic concepts such as primitive roots and quadratic residues.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
Graph theoryEdit
Paley graphs are dense undirected graphs, one for each prime p ≡ 1 (mod 4), that form an infinite family of conference graphs, which yield an infinite family of symmetric conference matrices.
Paley digraphs are directed analogs of Paley graphs, one for each p ≡ 3 (mod 4), that yield antisymmetric conference matrices.
The construction of these graphs uses quadratic residues.
CryptographyEdit
The fact that finding a square root of a number modulo a large composite n is equivalent to factoring (which is widely believed to be a hard problem) has been used for constructing cryptographic schemes such as the Rabin cryptosystem and the oblivious transfer. The quadratic residuosity problem is the basis for the Goldwasser-Micali cryptosystem.
The discrete logarithm is a similar problem that is also used in cryptography.
Primality testingEdit
Euler's criterion is a formula for the Legendre symbol (a|p) where p is prime. If p is composite the formula may or may not compute (a|p) correctly. The Solovay–Strassen primality test for whether a given number n is prime or composite picks a random a and computes (a|n) using a modification of Euclid's algorithm,<ref>Template:Harvnb</ref> and also using Euler's criterion.<ref>Template:Harvnb; Euler's criterion requires O(log3 n) steps</ref> If the results disagree, n is composite; if they agree, n may be composite or prime. For a composite n at least 1/2 the values of a in the range 2, 3, ..., n − 1 will return "n is composite"; for prime n none will. If, after using many different values of a, n has not been proved composite it is called a "probable prime".
The Miller–Rabin primality test is based on the same principles. There is a deterministic version of it, but the proof that it works depends on the generalized Riemann hypothesis; the output from this test is "n is definitely composite" or "either n is prime or the GRH is false". If the second output ever occurs for a composite n, then the GRH would be false, which would have implications through many branches of mathematics.
Integer factorizationEdit
In § VI of the Disquisitiones Arithmeticae<ref>Gauss, DA, arts 329–334</ref> Gauss discusses two factoring algorithms that use quadratic residues and the law of quadratic reciprocity.
Several modern factorization algorithms (including Dixon's algorithm, the continued fraction method, the quadratic sieve, and the number field sieve) generate small quadratic residues (modulo the number being factorized) in an attempt to find a congruence of squares which will yield a factorization. The number field sieve is the fastest general-purpose factorization algorithm known.
Table of quadratic residuesEdit
The following table (sequence A096008 in the OEIS) lists the quadratic residues mod 1 to 75 (a Template:Ifsubst style="color:crimson">red number means it is not coprime to n). (For the quadratic residues coprime to n, see Template:Oeis, and for nonzero quadratic residues, see Template:Oeis.)
n | quadratic residues mod n | n | quadratic residues mod n | n | quadratic residues mod n |
---|---|---|---|---|---|
1 | 0 | 26 | Template:Ifsubst style="color:crimson">0, 1, 3, Template:Ifsubst style="color:crimson">4, 9, Template:Ifsubst style="color:crimson">10, Template:Ifsubst style="color:crimson">12, Template:Ifsubst style="color:crimson">13, Template:Ifsubst style="color:crimson">14, Template:Ifsubst style="color:crimson">16, 17, Template:Ifsubst style="color:crimson">22, 23, 25 | 51 | Template:Ifsubst style="color:crimson">0, 1, 4, Template:Ifsubst style="color:crimson">9, 13, Template:Ifsubst style="color:crimson">15, 16, Template:Ifsubst style="color:crimson">18, 19, Template:Ifsubst style="color:crimson">21, 25, Template:Ifsubst style="color:crimson">30, Template:Ifsubst style="color:crimson">33, Template:Ifsubst style="color:crimson">34, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">42, 43, 49 |
2 | Template:Ifsubst style="color:crimson">0, 1 | 27 | Template:Ifsubst style="color:crimson">0, 1, 4, 7, Template:Ifsubst style="color:crimson">9, 10, 13, 16, 19, 22, 25 | 52 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 9, Template:Ifsubst style="color:crimson">12, Template:Ifsubst style="color:crimson">13, Template:Ifsubst style="color:crimson">16, 17, 25, 29, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">40, Template:Ifsubst style="color:crimson">48, 49 |
3 | Template:Ifsubst style="color:crimson">0, 1 | 28 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">8, 9, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">21, 25 | 53 | Template:Ifsubst style="color:crimson">0, 1, 4, 6, 7, 9, 10, 11, 13, 15, 16, 17, 24, 25, 28, 29, 36, 37, 38, 40, 42, 43, 44, 46, 47, 49, 52 |
4 | Template:Ifsubst style="color:crimson">0, 1 | 29 | Template:Ifsubst style="color:crimson">0, 1, 4, 5, 6, 7, 9, 13, 16, 20, 22, 23, 24, 25, 28 | 54 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 7, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">10, 13, Template:Ifsubst style="color:crimson">16, 19, Template:Ifsubst style="color:crimson">22, 25, Template:Ifsubst style="color:crimson">27, Template:Ifsubst style="color:crimson">28, 31, Template:Ifsubst style="color:crimson">34, Template:Ifsubst style="color:crimson">36, 37, Template:Ifsubst style="color:crimson">40, 43, Template:Ifsubst style="color:crimson">46, 49, Template:Ifsubst style="color:crimson">52 |
5 | Template:Ifsubst style="color:crimson">0, 1, 4 | 30 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">6, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">10, Template:Ifsubst style="color:crimson">15, Template:Ifsubst style="color:crimson">16, 19, Template:Ifsubst style="color:crimson">21, Template:Ifsubst style="color:crimson">24, Template:Ifsubst style="color:crimson">25 | 55 | Template:Ifsubst style="color:crimson">0, 1, 4, Template:Ifsubst style="color:crimson">5, 9, Template:Ifsubst style="color:crimson">11, 14, Template:Ifsubst style="color:crimson">15, 16, Template:Ifsubst style="color:crimson">20, Template:Ifsubst style="color:crimson">25, 26, 31, 34, 36, Template:Ifsubst style="color:crimson">44, Template:Ifsubst style="color:crimson">45, 49 |
6 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">3, Template:Ifsubst style="color:crimson">4 | 31 | Template:Ifsubst style="color:crimson">0, 1, 2, 4, 5, 7, 8, 9, 10, 14, 16, 18, 19, 20, 25, 28 | 56 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">8, 9, Template:Ifsubst style="color:crimson">16, 25, Template:Ifsubst style="color:crimson">28, Template:Ifsubst style="color:crimson">32, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">44, Template:Ifsubst style="color:crimson">49 |
7 | Template:Ifsubst style="color:crimson">0, 1, 2, 4 | 32 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 9, Template:Ifsubst style="color:crimson">16, 17, 25 | 57 | Template:Ifsubst style="color:crimson">0, 1, 4, Template:Ifsubst style="color:crimson">6, 7, Template:Ifsubst style="color:crimson">9, 16, Template:Ifsubst style="color:crimson">19, Template:Ifsubst style="color:crimson">24, 25, 28, Template:Ifsubst style="color:crimson">30, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">39, Template:Ifsubst style="color:crimson">42, 43, Template:Ifsubst style="color:crimson">45, 49, Template:Ifsubst style="color:crimson">54, 55 |
8 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4 | 33 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">3, 4, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">12, Template:Ifsubst style="color:crimson">15, 16, Template:Ifsubst style="color:crimson">22, 25, Template:Ifsubst style="color:crimson">27, 31 | 58 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 5, Template:Ifsubst style="color:crimson">6, 7, 9, 13, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">20, Template:Ifsubst style="color:crimson">22, 23, Template:Ifsubst style="color:crimson">24, 25, Template:Ifsubst style="color:crimson">28, Template:Ifsubst style="color:crimson">29, Template:Ifsubst style="color:crimson">30, 33, Template:Ifsubst style="color:crimson">34, 35, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">38, Template:Ifsubst style="color:crimson">42, 45, 49, 51, Template:Ifsubst style="color:crimson">52, 53, Template:Ifsubst style="color:crimson">54, 57 |
9 | Template:Ifsubst style="color:crimson">0, 1, 4, 7 | 34 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">2, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">8, 9, 13, 15, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">17, Template:Ifsubst style="color:crimson">18, 19, 21, 25, Template:Ifsubst style="color:crimson">26, Template:Ifsubst style="color:crimson">30, Template:Ifsubst style="color:crimson">32, 33 | 59 | Template:Ifsubst style="color:crimson">0, 1, 3, 4, 5, 7, 9, 12, 15, 16, 17, 19, 20, 21, 22, 25, 26, 27, 28, 29, 35, 36, 41, 45, 46, 48, 49, 51, 53, 57 |
10 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">5, Template:Ifsubst style="color:crimson">6, 9 | 35 | Template:Ifsubst style="color:crimson">0, 1, 4, 9, 11, Template:Ifsubst style="color:crimson">14, Template:Ifsubst style="color:crimson">15, 16, Template:Ifsubst style="color:crimson">21, Template:Ifsubst style="color:crimson">25, 29, Template:Ifsubst style="color:crimson">30 | 60 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">21, Template:Ifsubst style="color:crimson">24, Template:Ifsubst style="color:crimson">25, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">40, Template:Ifsubst style="color:crimson">45, 49 |
11 | Template:Ifsubst style="color:crimson">0, 1, 3, 4, 5, 9 | 36 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">9, 13, Template:Ifsubst style="color:crimson">16, 25, Template:Ifsubst style="color:crimson">28 | 61 | Template:Ifsubst style="color:crimson">0, 1, 3, 4, 5, 9, 12, 13, 14, 15, 16, 19, 20, 22, 25, 27, 34, 36, 39, 41, 42, 45, 46, 47, 48, 49, 52, 56, 57, 58, 60 |
12 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">9 | 37 | Template:Ifsubst style="color:crimson">0, 1, 3, 4, 7, 9, 10, 11, 12, 16, 21, 25, 26, 27, 28, 30, 33, 34, 36 | 62 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">2, Template:Ifsubst style="color:crimson">4, 5, 7, Template:Ifsubst style="color:crimson">8, 9, Template:Ifsubst style="color:crimson">10, Template:Ifsubst style="color:crimson">14, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">18, 19, Template:Ifsubst style="color:crimson">20, 25, Template:Ifsubst style="color:crimson">28, Template:Ifsubst style="color:crimson">31, Template:Ifsubst style="color:crimson">32, 33, 35, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">38, 39, Template:Ifsubst style="color:crimson">40, 41, 45, 47, 49, Template:Ifsubst style="color:crimson">50, 51, Template:Ifsubst style="color:crimson">56, 59 |
13 | Template:Ifsubst style="color:crimson">0, 1, 3, 4, 9, 10, 12 | 38 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 5, Template:Ifsubst style="color:crimson">6, 7, 9, 11, Template:Ifsubst style="color:crimson">16, 17, Template:Ifsubst style="color:crimson">19, Template:Ifsubst style="color:crimson">20, 23, Template:Ifsubst style="color:crimson">24, 25, Template:Ifsubst style="color:crimson">26, Template:Ifsubst style="color:crimson">28, Template:Ifsubst style="color:crimson">30, 35, Template:Ifsubst style="color:crimson">36 | 63 | Template:Ifsubst style="color:crimson">0, 1, 4, Template:Ifsubst style="color:crimson">7, Template:Ifsubst style="color:crimson">9, 16, Template:Ifsubst style="color:crimson">18, 22, 25, Template:Ifsubst style="color:crimson">28, Template:Ifsubst style="color:crimson">36, 37, 43, 46, Template:Ifsubst style="color:crimson">49, 58 |
14 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">2, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">7, Template:Ifsubst style="color:crimson">8, 9, 11 | 39 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">3, 4, Template:Ifsubst style="color:crimson">9, 10, Template:Ifsubst style="color:crimson">12, Template:Ifsubst style="color:crimson">13, 16, 22, 25, Template:Ifsubst style="color:crimson">27, Template:Ifsubst style="color:crimson">30, Template:Ifsubst style="color:crimson">36 | 64 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 9, Template:Ifsubst style="color:crimson">16, 17, 25, 33, Template:Ifsubst style="color:crimson">36, 41, 49, 57 |
15 | Template:Ifsubst style="color:crimson">0, 1, 4, Template:Ifsubst style="color:crimson">6, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">10 | 40 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 9, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">20, Template:Ifsubst style="color:crimson">24, Template:Ifsubst style="color:crimson">25, Template:Ifsubst style="color:crimson">36 | 65 | Template:Ifsubst style="color:crimson">0, 1, 4, 9, Template:Ifsubst style="color:crimson">10, 14, 16, Template:Ifsubst style="color:crimson">25, Template:Ifsubst style="color:crimson">26, 29, Template:Ifsubst style="color:crimson">30, Template:Ifsubst style="color:crimson">35, 36, Template:Ifsubst style="color:crimson">39, Template:Ifsubst style="color:crimson">40, 49, 51, Template:Ifsubst style="color:crimson">55, 56, 61, 64 |
16 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 9 | 41 | Template:Ifsubst style="color:crimson">0, 1, 2, 4, 5, 8, 9, 10, 16, 18, 20, 21, 23, 25, 31, 32, 33, 36, 37, 39, 40 | 66 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">3, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">12, Template:Ifsubst style="color:crimson">15, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">22, 25, Template:Ifsubst style="color:crimson">27, 31, Template:Ifsubst style="color:crimson">33, Template:Ifsubst style="color:crimson">34, Template:Ifsubst style="color:crimson">36, 37, Template:Ifsubst style="color:crimson">42, Template:Ifsubst style="color:crimson">45, Template:Ifsubst style="color:crimson">48, 49, Template:Ifsubst style="color:crimson">55, Template:Ifsubst style="color:crimson">58, Template:Ifsubst style="color:crimson">60, Template:Ifsubst style="color:crimson">64 |
17 | Template:Ifsubst style="color:crimson">0, 1, 2, 4, 8, 9, 13, 15, 16 | 42 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">7, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">15, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">18, Template:Ifsubst style="color:crimson">21, Template:Ifsubst style="color:crimson">22, 25, Template:Ifsubst style="color:crimson">28, Template:Ifsubst style="color:crimson">30, Template:Ifsubst style="color:crimson">36, 37, Template:Ifsubst style="color:crimson">39 | 67 | Template:Ifsubst style="color:crimson">0, 1, 4, 6, 9, 10, 14, 15, 16, 17, 19, 21, 22, 23, 24, 25, 26, 29, 33, 35, 36, 37, 39, 40, 47, 49, 54, 55, 56, 59, 60, 62, 64, 65 |
18 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 7, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">10, 13, Template:Ifsubst style="color:crimson">16 | 43 | Template:Ifsubst style="color:crimson">0, 1, 4, 6, 9, 10, 11, 13, 14, 15, 16, 17, 21, 23, 24, 25, 31, 35, 36, 38, 40, 41 | 68 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">8, 9, 13, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">17, 21, 25, Template:Ifsubst style="color:crimson">32, 33, Template:Ifsubst style="color:crimson">36, 49, Template:Ifsubst style="color:crimson">52, 53, Template:Ifsubst style="color:crimson">60, Template:Ifsubst style="color:crimson">64 |
19 | Template:Ifsubst style="color:crimson">0, 1, 4, 5, 6, 7, 9, 11, 16, 17 | 44 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 5, 9, Template:Ifsubst style="color:crimson">12, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">20, 25, Template:Ifsubst style="color:crimson">33, Template:Ifsubst style="color:crimson">36, 37 | 69 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">3, 4, Template:Ifsubst style="color:crimson">6, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">12, 13, 16, Template:Ifsubst style="color:crimson">18, Template:Ifsubst style="color:crimson">24, 25, Template:Ifsubst style="color:crimson">27, 31, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">39, Template:Ifsubst style="color:crimson">46, Template:Ifsubst style="color:crimson">48, 49, 52, Template:Ifsubst style="color:crimson">54, 55, 58, 64 |
20 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">5, 9, Template:Ifsubst style="color:crimson">16 | 45 | Template:Ifsubst style="color:crimson">0, 1, 4, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">10, 16, 19, Template:Ifsubst style="color:crimson">25, 31, 34, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">40 | 70 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, 9, 11, Template:Ifsubst style="color:crimson">14, Template:Ifsubst style="color:crimson">15, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">21, Template:Ifsubst style="color:crimson">25, 29, Template:Ifsubst style="color:crimson">30, Template:Ifsubst style="color:crimson">35, Template:Ifsubst style="color:crimson">36, 39, Template:Ifsubst style="color:crimson">44, Template:Ifsubst style="color:crimson">46, Template:Ifsubst style="color:crimson">49, Template:Ifsubst style="color:crimson">50, 51, Template:Ifsubst style="color:crimson">56, Template:Ifsubst style="color:crimson">60, Template:Ifsubst style="color:crimson">64, Template:Ifsubst style="color:crimson">65 |
21 | Template:Ifsubst style="color:crimson">0, 1, 4, Template:Ifsubst style="color:crimson">7, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">15, 16, Template:Ifsubst style="color:crimson">18 | 46 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">2, 3, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">6, Template:Ifsubst style="color:crimson">8, 9, Template:Ifsubst style="color:crimson">12, 13, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">18, Template:Ifsubst style="color:crimson">23, Template:Ifsubst style="color:crimson">24, 25, Template:Ifsubst style="color:crimson">26, 27, 29, 31, Template:Ifsubst style="color:crimson">32, 35, Template:Ifsubst style="color:crimson">36, 39, 41 | 71 | Template:Ifsubst style="color:crimson">0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 19, 20, 24, 25, 27, 29, 30, 32, 36, 37, 38, 40, 43, 45, 48, 49, 50, 54, 57, 58, 60, 64 |
22 | Template:Ifsubst style="color:crimson">0, 1, 3, Template:Ifsubst style="color:crimson">4, 5, 9, Template:Ifsubst style="color:crimson">11, Template:Ifsubst style="color:crimson">12, Template:Ifsubst style="color:crimson">14, 15, Template:Ifsubst style="color:crimson">16, Template:Ifsubst style="color:crimson">20 | 47 | Template:Ifsubst style="color:crimson">0, 1, 2, 3, 4, 6, 7, 8, 9, 12, 14, 16, 17, 18, 21, 24, 25, 27, 28, 32, 34, 36, 37, 42 | 72 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">16, 25, Template:Ifsubst style="color:crimson">28, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">40, 49, Template:Ifsubst style="color:crimson">52, Template:Ifsubst style="color:crimson">64 |
23 | Template:Ifsubst style="color:crimson">0, 1, 2, 3, 4, 6, 8, 9, 12, 13, 16, 18 | 48 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">16, 25, Template:Ifsubst style="color:crimson">33, Template:Ifsubst style="color:crimson">36 | 73 | Template:Ifsubst style="color:crimson">0, 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 19, 23, 24, 25, 27, 32, 35, 36, 37, 38, 41, 46, 48, 49, 50, 54, 55, 57, 61, 64, 65, 67, 69, 70, 71, 72 |
24 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">9, Template:Ifsubst style="color:crimson">12, Template:Ifsubst style="color:crimson">16 | 49 | Template:Ifsubst style="color:crimson">0, 1, 2, 4, 8, 9, 11, 15, 16, 18, 22, 23, 25, 29, 30, 32, 36, 37, 39, 43, 44, 46 | 74 | Template:Ifsubst style="color:crimson">0, 1, 3, Template:Ifsubst style="color:crimson">4, 7, 9, Template:Ifsubst style="color:crimson">10, 11, Template:Ifsubst style="color:crimson">12, Template:Ifsubst style="color:crimson">16, 21, 25, Template:Ifsubst style="color:crimson">26, 27, Template:Ifsubst style="color:crimson">28, Template:Ifsubst style="color:crimson">30, 33, Template:Ifsubst style="color:crimson">34, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">37, Template:Ifsubst style="color:crimson">38, Template:Ifsubst style="color:crimson">40, 41, Template:Ifsubst style="color:crimson">44, Template:Ifsubst style="color:crimson">46, 47, Template:Ifsubst style="color:crimson">48, 49, 53, Template:Ifsubst style="color:crimson">58, Template:Ifsubst style="color:crimson">62, 63, Template:Ifsubst style="color:crimson">64, 65, 67, Template:Ifsubst style="color:crimson">70, 71, 73 |
25 | Template:Ifsubst style="color:crimson">0, 1, 4, 6, 9, 11, 14, 16, 19, 21, 24 | 50 | Template:Ifsubst style="color:crimson">0, 1, Template:Ifsubst style="color:crimson">4, Template:Ifsubst style="color:crimson">6, 9, 11, Template:Ifsubst style="color:crimson">14, Template:Ifsubst style="color:crimson">16, 19, 21, Template:Ifsubst style="color:crimson">24, Template:Ifsubst style="color:crimson">25, Template:Ifsubst style="color:crimson">26, 29, 31, Template:Ifsubst style="color:crimson">34, Template:Ifsubst style="color:crimson">36, 39, 41, Template:Ifsubst style="color:crimson">44, Template:Ifsubst style="color:crimson">46, 49 | 75 | Template:Ifsubst style="color:crimson">0, 1, 4, Template:Ifsubst style="color:crimson">6, Template:Ifsubst style="color:crimson">9, 16, 19, Template:Ifsubst style="color:crimson">21, Template:Ifsubst style="color:crimson">24, Template:Ifsubst style="color:crimson">25, 31, 34, Template:Ifsubst style="color:crimson">36, Template:Ifsubst style="color:crimson">39, 46, 49, Template:Ifsubst style="color:crimson">51, Template:Ifsubst style="color:crimson">54, 61, 64, Template:Ifsubst style="color:crimson">66, Template:Ifsubst style="color:crimson">69 |
x | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x2 | 1 | 4 | 9 | 16 | 25 | 36 | 49 | 64 | 81 | 100 | 121 | 144 | 169 | 196 | 225 | 256 | 289 | 324 | 361 | 400 | 441 | 484 | 529 | 576 | 625 |
mod 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
mod 2 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 |
mod 3 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 |
mod 4 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 |
mod 5 | 1 | 4 | 4 | 1 | 0 | 1 | 4 | 4 | 1 | 0 | 1 | 4 | 4 | 1 | 0 | 1 | 4 | 4 | 1 | 0 | 1 | 4 | 4 | 1 | 0 |
mod 6 | 1 | 4 | 3 | 4 | 1 | 0 | 1 | 4 | 3 | 4 | 1 | 0 | 1 | 4 | 3 | 4 | 1 | 0 | 1 | 4 | 3 | 4 | 1 | 0 | 1 |
mod 7 | 1 | 4 | 2 | 2 | 4 | 1 | 0 | 1 | 4 | 2 | 2 | 4 | 1 | 0 | 1 | 4 | 2 | 2 | 4 | 1 | 0 | 1 | 4 | 2 | 2 |
mod 8 | 1 | 4 | 1 | 0 | 1 | 4 | 1 | 0 | 1 | 4 | 1 | 0 | 1 | 4 | 1 | 0 | 1 | 4 | 1 | 0 | 1 | 4 | 1 | 0 | 1 |
mod 9 | 1 | 4 | 0 | 7 | 7 | 0 | 4 | 1 | 0 | 1 | 4 | 0 | 7 | 7 | 0 | 4 | 1 | 0 | 1 | 4 | 0 | 7 | 7 | 0 | 4 |
mod 10 | 1 | 4 | 9 | 6 | 5 | 6 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 6 | 5 | 6 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 6 | 5 |
mod 11 | 1 | 4 | 9 | 5 | 3 | 3 | 5 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 5 | 3 | 3 | 5 | 9 | 4 | 1 | 0 | 1 | 4 | 9 |
mod 12 | 1 | 4 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 4 | 1 | 0 | 1 |
mod 13 | 1 | 4 | 9 | 3 | 12 | 10 | 10 | 12 | 3 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 3 | 12 | 10 | 10 | 12 | 3 | 9 | 4 | 1 |
mod 14 | 1 | 4 | 9 | 2 | 11 | 8 | 7 | 8 | 11 | 2 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 2 | 11 | 8 | 7 | 8 | 11 | 2 | 9 |
mod 15 | 1 | 4 | 9 | 1 | 10 | 6 | 4 | 4 | 6 | 10 | 1 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 1 | 10 | 6 | 4 | 4 | 6 | 10 |
mod 16 | 1 | 4 | 9 | 0 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 0 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 0 | 9 | 4 | 1 | 0 | 1 |
mod 17 | 1 | 4 | 9 | 16 | 8 | 2 | 15 | 13 | 13 | 15 | 2 | 8 | 16 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 16 | 8 | 2 | 15 | 13 |
mod 18 | 1 | 4 | 9 | 16 | 7 | 0 | 13 | 10 | 9 | 10 | 13 | 0 | 7 | 16 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 16 | 7 | 0 | 13 |
mod 19 | 1 | 4 | 9 | 16 | 6 | 17 | 11 | 7 | 5 | 5 | 7 | 11 | 17 | 6 | 16 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 16 | 6 | 17 |
mod 20 | 1 | 4 | 9 | 16 | 5 | 16 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 16 | 5 | 16 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 16 | 5 |
mod 21 | 1 | 4 | 9 | 16 | 4 | 15 | 7 | 1 | 18 | 16 | 16 | 18 | 1 | 7 | 15 | 4 | 16 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 16 |
mod 22 | 1 | 4 | 9 | 16 | 3 | 14 | 5 | 20 | 15 | 12 | 11 | 12 | 15 | 20 | 5 | 14 | 3 | 16 | 9 | 4 | 1 | 0 | 1 | 4 | 9 |
mod 23 | 1 | 4 | 9 | 16 | 2 | 13 | 3 | 18 | 12 | 8 | 6 | 6 | 8 | 12 | 18 | 3 | 13 | 2 | 16 | 9 | 4 | 1 | 0 | 1 | 4 |
mod 24 | 1 | 4 | 9 | 16 | 1 | 12 | 1 | 16 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | 16 | 1 | 12 | 1 | 16 | 9 | 4 | 1 | 0 | 1 |
mod 25 | 1 | 4 | 9 | 16 | 0 | 11 | 24 | 14 | 6 | 0 | 21 | 19 | 19 | 21 | 0 | 6 | 14 | 24 | 11 | 0 | 16 | 9 | 4 | 1 | 0 |
See alsoEdit
- Euler's criterion
- Gauss's lemma
- Zolotarev's lemma
- Character sum
- Law of quadratic reciprocity
- Quadratic residue code
NotesEdit
ReferencesEdit
The Disquisitiones Arithmeticae has been translated from Gauss's Ciceronian Latin into English and German. The German edition includes all of his papers on number theory: all the proofs of quadratic reciprocity, the determination of the sign of the Gauss sum, the investigations into biquadratic reciprocity, and unpublished notes.
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation A7.1: AN1, pg.249.
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
External linksEdit
- {{#invoke:Template wrapper|{{#if:|list|wrap}}|_template=cite web
|_exclude=urlname, _debug, id |url = https://mathworld.wolfram.com/{{#if:QuadraticResidue%7CQuadraticResidue.html}} |title = Quadratic Residue |author = Weisstein, Eric W. |website = MathWorld |access-date = |ref = Template:SfnRef }}
Template:Number theory Template:Polynomials Template:Geometry Template:Algebra