Section 17.5 Some Surprising Applications of QR
ΒΆSubsection 17.5.1 Factoring, briefly
ΒΆAs an example, it can help us with factoring large integers n; Gauss used it. The process itself is a little too long to describe here, but it's important to get the flavor. The essential idea is that if a is a QR of n, then a is a QR of any prime pβ£n. QRs often have congruence conditions associated with them, so n must obey all of the congruence conditions for (ap) for all the p which divide it. This might be a lot of conditions, which narrows the field considerably. Then we can use a variant on the Fermat factoring method to check for possible a for which a prime divisor p of n definitely is or definitely is not a QR (again, quadratic reciprocity can help), and then one can compute Legendre/Jacobi symbols of possible pβ£n to reduce to just having to check a very few bigger possible prime factors.Subsection 17.5.2 Primality testing
ΒΆAnother application is that it can help us check primality. A specific example where it is helpful is with the so-called Fermat numbers. Recall (Subsection 12.1.1) that Euler blasted the following conjecture of Fermat's out of the water by disproving it for n=5:xxxxxxxxxx
def _(n=(1,[1..6])):
F=2^(2^n)+1
pretty_print(html("The $%s$th Fermat number is $%s$"%(n,F)))
test = mod(3,F)^((F-1)/2)
if test == -1:
pretty_print(html(r"Since $3^{(%s-1)/2}\equiv %s$, this Fermat number is prime"%(F,test)))
else:
pretty_print(html(r"Since $3^{(%s-1)/2}\equiv %s$, this Fermat number is not prime"%(F,test)))
Fact 17.5.1. PΓ©pin's Test.
For n>0, Fn=22n+1 is prime exactly when
Proof.
We will try to connect this with Euler's Criterion. Note that \((F_n-1)/2 = 2^{2^n-1}\text{,}\) the power of three in the statement.
First, let's assume \(F_n\) is prime. Since \(F_n\) is one more than a multiple of four, clearly
Let's examine a few cases.
If \(F_n\equiv 1\text{ (mod }12)\text{,}\) then \(3\mid 2^{2^n}=F_n-1\text{,}\) which cannot be true.
If \(F_n\equiv 9\text{ (mod }12)\text{,}\) then \(F_n\) is a number greater than three which is divisible by three β but it's prime, so that's not possible.
So \(F_n\equiv 5\text{ (mod }12).\)
Since \(F_n\) is prime, that means by Proposition 17.3.4 we know \(3\) is not a QR mod \(F_n\text{.}\) Thus Theorem 16.5.2 should give \(-1\text{.}\)
For the converse, let's assume that Euler's Criterion gives this answer of \(-1\) for \(a=3\text{.}\) Then square both sides to get
for all primes \(p\) dividing \(F_n\text{.}\) Now, what order does \(3\) have here?
Since \(F_n-1=2^{2^n}\text{,}\) that means 3 has order some power of \(2\) (in \(U_p\)).
But 3 can't have order \(2^{2^n-1}\) (or less), because it isn't the identity when taken to that power.
So it must have order \(2^{2^n}\text{.}\)
The only way 3 can have that big an order is if \(p\) is at least \(2^{2^n}+1=F_n\text{.}\) So since \(p\mid F_n\text{,}\) they must be equal!
Remark 17.5.2.
Interestingly, Mersenne numbers can sometimes also be shown to be composite using quadratic residues. For instance, 2pβ1 with exponent pβ‘3 (mod 4) which is itself a Germain prime must be composite. See [C.2.13, Theorem 7.6], and see [C.2.4, Exercises 9.1.37-40] for many more criteria like this.
Subsection 17.5.3 Yes, even cryptography
ΒΆSuppose we have two primes p and q that are both of the form 4n+3. Then it should (probabilistically) be possible to find a number a such thatSubsection 17.5.4 Solving equations
ΒΆThere is even more! As one example, quadratic reciprocity (or at least the Legendre symbol) helps us solve Mordell equations; e.g. Fact 15.3.3 and similar facts implicitly use (β1p). The next easiest cases use (2p) and multiplicativity. But more advanced ones need to compute more complicated square roots. Here are two examples, without proof.The equation x3=y2+16 has no integer solutions. (Uses (β8p).)
The equation x3=y2β46 has no integer solutions. (Uses (β18p).)
Subsection 17.5.5 Artin's conjecture
ΒΆLet's return to the test for Fn's primality in Fact 17.5.1. A careful look at the proof shows that 3 is a primitive root for Fn, if Fn is prime. Thus, if we had infinitely many Fermat primes (and not just five of them), we'd have an integer which is a primitive root of infinitely many primes. Such would provide a proof of at least one explicit case for the following long-standing question.Conjecture 17.5.3. Artin's Conjecture.
Every nonsquare integer except β1 is a primitive root for infinitely many primes.
Although it is mostly believed to be true, currently there are no integers known to be a primitive root for infinitely primes.
Weirder, it is known that at least one of 3, 5, or 7 is a primitive root for infinitely many primes) but we don't know which one!
-
Weirdest, it has been proved that there are at most two exceptions to this conjecture, yet we also know of no integers which do not satisfy it!
That is, there are at most two nonsquare integers which are not a primitive root for infinitely many primes, yet we do not have a single specific integer which we can prove that for.
xxxxxxxxxx
def _(n=(1,[1..6])):
F = 2^(2^n)+1
a = mod(3,F)
if a.multiplicative_order()==F-1:
pretty_print(html("$3$ is a primitive root of $F_{%s}=%s$"%(n,F)))
else:
pretty_print(html("Not prime, no primitive root!"))
Example 17.5.4.
We put this in the form of several steps. Verifying several facts in these steps is left to Exercise Group 17.7.8β11.
Recall from the very end of Section 11.6 that if q and p=2q+1 are both odd primes, then we call q a Germain prime. In that case, every residue of p other than a=β1 and a=0 is a primitive root or a QR. One way to interpret this is as complementing Fact 16.4.5, which characterizes even powers of a primitive root as being QRs; namely, for p nearly all odd powers must be primitive roots.
Such a prime p must be of the form pβ‘3 (mod 4). This follows because q is odd so q=2k+1 for some integer k, yielding
(This is how we know that β1, which is clearly not a primitive root, also isn't a QR; recall Fact 16.1.2.)
In this case, not only are all residues other than 0,β1 either a primitive root or a QR, but a is one of these things precisely when pβa is the other. We know that
are all different modulo p, and of course all of these are QRs (and so not primitive roots).
Here is the key; that means that the additive inverses of perfect squares, pβk2, for 2β€kβ€q, must all be primitive roots. The smallest of these, pβ4, must thus be a primitive root for any such (safe; recall Subsection 11.6.4) prime p=2q+1.
xxxxxxxxxx
def _(q=(11,[r for r in prime_range(3,100) if is_prime(2*r+1)])):
p = 2*q+1
a=mod(p-4,p)
if a.multiplicative_order()==p-1:
pretty_print(html("$-4$ is a primitive root of $%s$"%p))
else:
pretty_print(html("Mistake!"))