Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Mathematics 4: Number Theory Problem Sheet 4 Workshop 9 Nov 2012 Working with quadratic residues and primitive roots (1) Given an odd prime p with g a primitive root (mod p), which powers of g are: (a) quadratic residues? (b) primitive roots? (Just need to refer to results from notes.) The quadratic residues are the even powers of g, while the primitive roots are the powers g k with gcd(k, p − 1) = 1. (2) For p = 3, 5, 7 and 11: (a) find a primitive root; (b) work out which of 1, 2, . . . , p − 1 are • quadratic residues; • primitive roots; • neither. p = 3: 1 =QR, 2 =PR. p = 5: 1 =QR, 2 =PR, 3 =PR, 4 =QR. p = 7: 1 =QR, 2 =QR, 3 =PR, 4 =QR, 5 =PR, 6 =neither. p = 11: 1 =QR, 2 =PR, 3 =QR, 4 =QR, 5 =QR, 6 =PR, 7 =PR, 8 =PR, 9 =QR, 10 =neither. (3) Evaluate −2 for odd primes p. When is p − 2 a quadratic residue? p p−2 p = −2 p = −1 p 2 2 = (−1)(p−1)/2 (−1)(p −1)/8 p = (−1)(p−1)(p+5)/8 , which is 1 if p ≡ 1 or 3 (mod 8) and −1 if p ≡ 5 or 7 (mod 8). (4) Show that if p = 8n − 1 and q = 4n − 1 are both primes, then (−2)q ≡ −1 (mod p). Deduce that −2 is a primitive root (mod p). Now (−2)q = (−2)(p−1)/2 = −2 (Euler’s criterion), which is = −1 by p Q3. Now p − 1 = 2q so that (−2)2q ≡ 1 (mod p) (Fermat). If −2 is not a primitive root then (−2)r ≡ 1 (mod p) for some factor r < p−1 of p− 1 2 1. So either (−2)2 ≡ 1 (mod p)( not possible as q > 1 so n > 0, p > 3) or (−2)q ≡ 1 (mod p), which is also false, as we’ve just shown. Now recall (special case of Q 4(b), Problem Sheet 3)) that if ak ≡ 1 (mod p) and aℓ ≡ 1 (mod p) then agcd(k,ℓ) ≡ 1 (mod p). (5) Prime factors of Mp are large. Let p be an odd prime, and q be a prime factor of Mp = 2p − 1. (a) Show that 2gcd(p,q−1) ≡ 1 (mod q). Deduce that p | (q − 1), and hence that q = 2rp + 1 for some r ∈ N. (b) Find the prime factors of M11 . (c) If Mp is in fact prime, what is r? (a) From Mp ≡ 0 (mod q) we immediately have 2p ≡ 1 (mod q), while from Fermat we have 2q−1 ≡ 1 (mod q). Hence, by ‘‘Now recall...’’ above, we have 2gcd(p,q−1) ≡ 1 (mod q). This gcd is either 1 or p (the only factors of p), and clearly can’t be 1, so must be p. Hence p | (q − 1), giving q = r ′ p + 1. As q is odd, r ′ must be even, = 2r say. So q = 2rp + 1. (b) We have M11 = 23 · 89, both of the form 22r + 1. (c) In this case 2p − 1 = 2rp + 1 gives r = (2p−1 − 1)/p. Handin: due Friday, week 9, 16 Nov, before 12.10 lecture. Please hand it in at the lecture Prime factors of Fermat numbers are large You are expected to write clearly and legibly, giving thought to the presentation of your answer as a document written in mathematical English. k (6) Let k ∈ N and q be a prime factor of Fk = 22 + 1. k ℓ (a) Show that 22 ≡ −1 (mod q), and that 22 6≡ 1 (mod q) for ℓ = 1, 2, . . . , k. (b) Show that k+1 ) 2gcd(q−1,2 ≡ 1 (mod q). (c) Deduce that gcd(q − 1, 2k+1) = 2k+1 , and that q = 2k+1 r + 1 for some r ∈ N. (d) Use this to find a prime factor of F5 . 3 k ℓ (a) From Fk ≡ 0 (mod q) we get 22 ≡ −1 (mod q). If 22 ≡ 1 (mod q) k for some ℓ < k then, by repeated squaring, we would obtain 22 ≡ 1 (mod q), ℓ a contradiction. So 22 6≡ 1 (mod q) for ℓ = 1, 2, . . . , k. 3 marks (b) From Fermat we have 2q−1 ≡ 1 (mod q), while from squaring the result k+1 in part (a) we have 22 ≡ 1 (mod q). Hence, by the ‘‘Now recall...’’ result from the workshop, k+1 ) 2gcd(q−1,2 ≡ 1 (mod q), as req’d. (c) Now gcd(q − 1, 2k+1) is clearly some power 2ℓ with ℓ ≤ k + 1. if ℓ ≤ k, then we’d have 2 marks But ℓ 22 ≡ 1 (mod q), contradicting (a). So ℓ = k + 1 and gcd(q −1, 2k+1 ) = 2k+1, so that 2k+1 | (q − 1), giving q = 2k+1 r + 1 for some r ∈ N. 3 marks 6 6 (d) 641 = 2 · 10 + 1. (Other prime factor is 6700417 = 2 · 104694 + 1.) 2 marks Further quadratic residues and primitive root problems 23 2053 (7) Calculate the Legendre symbols (a) 31 , (b) 211 (c) 3061 using the law of qua307 dratic reciprocity. Check your answer with Maple. [with(numtheory): legendre] (8) If n is the product of k distinct odd primes, show that the congruence x2 ≡ 1 (mod n) has 2k different solutions. Suppose n = p1 . . . pk . Then, by the Chinese Remainder Theorem, we can solve any set of congruences x ≡ ε1 (mod p1 ), x ≡ ε2 (mod p2 ), . . . , x ≡ εk (mod pk ) for any of the 2k choices of the εj = ±1. P j (9) Prove that, for p an odd prime, p−1 j=1 p = 0. Let g be a primitive root mod p. Because {1, 2, . . . , p−1} = {1, g, g 2, . . . , g p−2} and the quadratic residues are the even powers of g and the quadratic nonresidues are the odd powers of g and there are the same number of even powers of g as odd powers of g in this set, it follows that the same number of pj are = 1 as are = −1. Hence their sum is 0. (10) Let p be an odd prime, and suppose that the set {1, 2, . . . , p − 1} is partitioned into two nonempty sets S1 and S2 such that the product (mod p) of any two elements in the same set is in S1 , while the product (mod p) of an element in S1 and an 4 element in S2 is in S2 . Prove that S1 is the set of quadratic residues (mod p) while S2 is the set of quadratic nonresidues (mod p). For any k, whether in S1 or S2 , k 2 ∈ S1 . Hence S1 contains all the quadratic residues. Next, take ℓ ∈ S2 . Then ℓ must be a quadratic nonresidue. By the rules, ℓk 2 ∈ S2 for all k, so that S2 contains all the nonresidues. Since the residues and nonresidues together exhaust {1, 2, . . . , p−1}, we see that S1 is the set of quadratic residues while S2 is the set of quadratic nonresidues. (11) Show that if 2n − 1 is prime, then n is prime. For if n = pq say, with p, q > 1 then since y − 1 divides y q − 1, we have (y = xp ) that xp − 1 divides xn − 1 = (xp )q − 1. Hence (x = 2) 2p − 1 divides 2n − 1 and 2p − 1 6= 1, 6= 2n − 1. (12) Show that if 2n + 1 is prime, then n is a power of 2. For suppose n = mℓ with ℓ > 1 and odd. Then since (x + 1) | (xℓ + 1), we’d have 2n + 1 = (2m )ℓ + 1 divisible by 2m + 1 < n. (13) Show that, for n > 1, 3 is a primitive root of any prime of the form 2n + 1. See Pépin’s Test in the notes. Sums of Squares Problems Throughout, ‘squares’ will mean ‘ squares of integers’, unless otherwise stated. (14) Show that a positive integer n is a sum of two squares iff n3 is the sum of two squares. Which exponents can replace ‘3’ in this result and have it remain true? By Thm. 6.5, n is a sum of two squares iff all primes q ≡ −1 (mod 4) divide n to an even power. since this applies to n iff it applies to n3 , we have the result. The exponent replacing 3 can be any odd positive integer. (15) Representing n as the difference of two squares. (a) Show that a square is ≡ 0 or 1 (mod 4). (b) Show that if n ≡ 2 (mod 4) then it is not a difference of two squares. 5 (c) With the help of (n + 1)2 − n2 and (n + 1)2 − (n − 1)2 , prove that all integers except those in (b) can be written as the difference of two squares. (a) (2k)2 ≡ 0 (mod 4) ≡ 0 or 4 (mod 8), (2k+1)2 = 8 k+1 +1 ≡ 1 (mod 8). 2 (b) By (a) the difference of two squares is (0 or 1) − (0 or 1) (mod 4), which cannot be 2 (mod 4). (c) Now (n+1)2 −n2 = 2n+1, so all odd numbers (i.e., those ≡ 1 or 3 (mod 4)) are covered. Also (n + 1)2 − (n − 1)2 = 4n so all numbers ≡ 0 (mod 4) are covered. (16) Show that if an odd number n is the sum of two squares then n ≡ 1 (mod 4). If n is odd and a sum of two squares then it is a product of primes p ≡ 1 (mod 4) and squares q 2 ≡ 1 (mod 8), where q ≡ −1 (mod 4). So, working mod 4, n ≡ 1 (mod 4). ALTERNATIVELY: If n = a2 +b2 then one of a, b is odd, say a, and the other even. So 2 a ≡ 1 (mod 4), b2 ≡ 0 (mod 4), so n = a2 + b2 ≡ 1 (mod 4). (17) Show that a positive integer n can be written as n = x2 + 4y 2 iff n is the sum of two squares and also n is not twice an odd number. If n = x2 + 4y 2 then n = x2 + (2y)2, a sum of two squares. If x is odd then n is odd, while if x is even then 4 | n. so n is not an odd multiple of 2. Conversely, if n = x2 +y 2 and also n is not twice an odd number, then x and y can’t both be odd, so, if say y = 2y ′ then n = x2 + 4y ′2 . (18) Which integers can be written as the difference of two nonzero squares? The formula (n+1)2 −n2 from Q15(c) gives nonzero squares except when n = 0 or −1. This shows that all odd numbers except 1 and −1 are the difference of two nonzero squares. And indeed 1 = 12 −02 and −1 = 02 − 12 clearly can’t be written as the difference of two nonzero squares, as no two nonzero squares differ by 1. The formula (n+1)2 −(n−1)2 from Q15(c) gives nonzero squares except when n = 1 or −1. This shows that all numbers ≡ 0 (mod 4) except 4 and −4 are the difference of two nonzero squares. And indeed 4 = 22 − 6 02 and −4 = 02 − 22 clearly can’t be written as the difference of two nonzero squares, as no two nonzero squares differ by 4. So all integers except ±1, ±4 and those ≡ 2 (mod 4) can be written as the difference of two nonzero squares. (19) Show that every integer can be written as the difference of two squares of rationals. The only case we need to consider if for n = 4k + 2 say. But then 4n is the difference of two squares, = a2 −b2 say, so that n = (a/2)2 − (b/2)2 . (20) Show that every integer can be written as x2 − y 2 + z 2 for some integers x, y, z. Using Q15, we see that we can take z = 0 except in the case where n is ≡ 2 (mod 4). In this case take z = 1. Then n − 1 is 6≡ 2 (mod 4), so is a difference of two squares. (21) Representing primes as x2 + 2y 2. = 1 iff p ≡ 1 or 3 (mod 8). (a) Show that, for an odd prime p, −2 p (b) Show that if an odd prime p can be written as p = x2 + 2y 2 , then p ≡ 1 or 3 (mod 8). (c) Conversely, following the proof of Th. 6.1 (which was for p = x2 + y 2), show that, for p a prime with p ≡ 1 or 3 (mod 8) there are positive integers x, y with x2 + 2y 2 = p or = 2p. (d) Show how a solution of x2 + 2y 2 = 2p gives rise to a solution of x2 + 2y 2 = p, so that a prime p ≡ 1 or 3 (mod 8) always has a representation p = x2 + 2y 2. p−1 p2 −1 2 (a) We have −2 = −1 = (−1) 2 ·(−1) 8 , which is = 1 precisely p p p when p ≡ 1 or 3 (mod 8). 2 2 −1 2 (b) From p = x + 2y we see that p ∤ y and (xy ) ≡ −2 (mod p), so that −2 = 1. Then use (a). p = (c) Conversely, assume p ≡ 1 or 3 (mod 8), and, knowing that then −2 p 1, take r ∈ N with r 2 ≡ −2 (mod p). Define f (u, v) = u + rv and K = √ ⌊ p⌋. Note that √ (1) K < p < K + 1, 7 √ as p 6∈ Z. Consider all pairs (u, v) with 0 ≤ u ≤ K and 0 ≤ v ≤ K. There are (K+1)2 > p such pairs, and so the multiset of all f (u, v) for such u, v has, by the Pigeonhole Principle, two such pairs (u1 , v1 ) 6= (u2 , v2 ) for which f (u1 , v1 ) ≡ f (u2 , v2 ) (mod p). Hence u1 + rv1 ≡ u2 + rv2 (mod p) u1 − u2 ≡ −r(v1 − v2 ) a ≡ −rb (mod p) (mod p), say, where a = u1 − v1 and b = v1 − v2 are not both 0. Hence a2 ≡ −2b2 (mod p) as r 2 ≡ −2 (mod p), so that p | (a2 + 2b2 ). But |a| ≤ K, |b| ≤ K, giving 0 < a2 + 2b2 ≤ 3K 2 < 3p. So a2 + 2b2 = p or = 2p. (d) If x2 +2y 2 = 2p then x must be even, = 2x′ say, and then y 2 +2x′2 = p. (22) Representing primes as x2 + 3y 2. = 1 iff p ≡ 1 (mod 6). [Work mod 12.] (a) Show that, for a prime p > 3, −3 p (b) Show that if a prime p > 3 can be written as p = x2 +3y 2, then p ≡ 1 (mod 6). (c) Conversely, following the proof of Th. 6.1, show that, for p a prime with p ≡ 1 (mod 6) there are positive integers x, y with x2 + 3y 2 = p or = 2p or = 3p. (d) Show that the case x2 + 3y 2 = 2p in (c) cannot occur, so that x2 + 3y 2 = p or = 3p. (e) Show how a solution of x2 + 3y 2 = 3p gives rise to a solution of x2 + 3y 2 = p, so that a prime p ≡ 1 (mod 6) always has a representation p = x2 + 3y 2 . (a) First take p ≡ 1 (mod 4). Then −3 = −1 · 3p = 1 · p3 , which p p is 1 only when p ≡ 1 (mod 3). So p≡ 1 (mod 12). −3 Next take p ≡ −1 (mod 4). Then p = −1 · p3 = (−1) · (− 3p ) = p3 p again. So p ≡ 1 (mod 3) and hence p ≡ 7 (mod 12). Thus p ≡ 1 (mod 6) covers both cases. 2 2 −1 2 (b) From p = x + 3y we see that p ∤ y and (xy ) ≡ −3 (mod p), so that −3 = 1. Then use (a). p = (c) Conversely, assume p ≡ 1 (mod 6), and, knowing that then −3 p 1, take r ∈ N with r 2 ≡ −3 (mod p). Define f (u, v) = u + rv and K = √ ⌊ p⌋. Note that √ (2) K < p < K + 1, 8 √ as p 6∈ Z. Consider all pairs (u, v) with 0 ≤ u ≤ K and 0 ≤ v ≤ K. There are (K+1)2 > p such pairs, and so the multiset of all f (u, v) for such u, v has, by the Pigeonhole Principle, two such pairs (u1 , v1 ) 6= (u2 , v2 ) for which f (u1 , v1 ) ≡ f (u2 , v2 ) (mod p). Hence u1 + rv1 ≡ u2 + rv2 (mod p) u1 − u2 ≡ −r(v1 − v2 ) a ≡ −rb (mod p) (mod p), say, where a = u1 − v1 and b = v1 − v2 are not both 0. Hence a2 ≡ −3b2 (mod p) as r 2 ≡ −3 (mod p), so that p | (a2 + 3b2 ). But |a| ≤ K, |b| ≤ K, giving 0 < a2 + 3b2 ≤ 4K 2 < 4p. So a2 + 3b2 = p or = 2p or = 3p. (d) If x2 + 3y 2 = 2p, then x, y can’t both be even, as then 4 | (x2 + 3y 2), or of opposite parity, as then x2 +3y 2 is odd, or both odd, as then x2 ≡ 1 (mod 8), 3y 2 ≡ 3 (mod 8), x2 + 3y 2 ≡ 4 (mod 8). (e) If x2 + 3y 2 = 3p then 3 | x, x = 3x′ say, and so y 2 + 3x′2 = p. Miscellaneous Problems (23) Prove Wolstenholme’s theorem: if p is a prime greater than 3 then the numerator of the fraction 1 1 1 1+ + +···+ 2 3 p−1 2 is divisible by p . Now 1/j + 1/(p − j) = p/(j(p − j)), so that (p−1)/2 X 1 1 1 1 1/(j(p − j)). (1 + + + · · · + )= p 2 3 p−1 j=1 It is now enough to prove that this latter sum is ≡ 0 (mod p). be a primitive root. We have (p−1)/2 X j=1 (p−1)/2 1/(j(p − j)) ≡ − X 1/j 2 (mod p) j=1 ≡ −(1 + g −2 + g −4 + · · · + g −2((p−3)/2) ) (mod p) in some order, since the squares are the even powers of g = −(g −(p−1) − 1)/(g −2 − 1) ≡ 0 (mod p) Let g 9 on summing the GP, using the fact that p > 3, and Fermat. (24) Suppose that a, b, c > 1 with ab ≡ 1 (mod c), bc ≡ 1 (mod a) and ca ≡ 1 (mod b). Prove that {a, b, c} = {2, 3, 5}. Now abc|(ab−1)(bc−1)(ca−1) ≡ ab + bc + ca − 1 (mod abc) ≡ N say. However 1 1 1 −1 + + N = abc c a b < abc − 1 unless 1c + a1 + 1b ≥ 1. Since a, b, c are pairwise relatively prime, it’s easy to see that {a, b, c} = {2, 3, 5} is the only possibility. (25) Let n be a positive integer. How many digits has n? What is its most significant digit? Its least significant digit? Assuming n has an odd number of digits, what is its middle digit? [The functions ⌊ ⌋ and log10 may be useful for this question.] The positive integer n has d := 1 + ⌊log10 n⌋ digits. (Check for n = 99, 100, 101.) [An alternative expression for d is d = ⌈log10 (n + 1)⌉.] Its most significant digit is ⌊n/10d−1 ⌋, while its least significant digit is n (mod 10). Assuming that n has an odd number d of digits, then the middle digit of n is ⌊n/10(d−1)/2 ⌋ (mod 10). (26) Cunningham chains. A sequence p1 , p2 , . . . , pk of primes is called a Cunningham chain if pi+1 = 2pi + 1 for i = 1, . . . , k − 1, and neither (p1 − 1)/2 nor 2pk + 1 are prime numbers. (a) Find the Cunningham chain with p1 = 2. (b) Show that any Cunningham chain containing any prime 6≡ 9 (mod 10) must either be the chain in (a), or have length at most 3. Give an example of the latter. (c) Deduce that any Cunningham chain of length 4 or more, apart from that in (a), must have every prime ≡ 9 (mod 10). (d) Show that pi = 2i−1 (p1 + 1) − 1 for i = 1, . . . , k. (e) Now take p1 > 2. Show that then p1 divides pp1 , and that k < p1 . (f) Check that the Cunningham chain with p1 = 2759832934171386593519 has length 17. [Maple: isprime] 10 (a) 2, 5, 11, 23, 47. (b) Modulo 10, a Cunningham seqence of odd numbers goes either 1, 3, 7, 5(?), or 9, 9, .... In the first case the number ending in 5 won’t be prime, so sequence must go 1, 3, 7, and then stop. First one is 41, 83, 167. (Next one is 1031, 2063, 4127.) (c) Immediate from (b). (d) Easy induction. (e) We have pp1 = 2p1 −1 (p1 +1)−1 ≡ 2p1 −1 (mod p1 ), which is ≡ 0 (mod p1 ) by Fermat. So pp1 is not prime, and hence k < p1 . (f)Maple: p:=2759832934171386593519; isprime((p-1)/2);isprime(p); for k from 2 to 18 do p:=2*p+1; print(k,p,isprime(p)); enddo: /home/chris/NTh/wkp4 12.tex