Docsity

MA 522 Fall 2008 Homework Solutions: Number Theory Problems - Prof. Agnes Szanto, Assignments of Mathematics

Toggle sidebar
bg1
Homework 6 Solutions
MA 522 Fall 2008
1. (25 points) Textbook, page 276, problem 9.40 (i) and (iii).
Solution:
(i) Zpis a field, therefore the polynomial x2−ahas at most two roots in Zp. If p= 2
then g=ais the only solution, so S2(a) = 1. If p|athen g2=amod pif and only if
p|g, so Sp(a) = 1. If 26=p6 |athen if g2=amod pthen (−g)2=amod p, so the num-
ber of solutions is even, either 0 or 2. Bothe cases are possible, e.g. S5(2) = 0 but S5(1) = 0.
(iii) Assume gcd(a, n)=1. If there exists isuch that Spei
i(a) = 0, then Sn(a) = 0, otherwise
we have that g2≡amod nimplies that g2≡amod pei. Assume that for each 1≤i≤r
Spei
i(a)>0, and take gi∈ {0, . . . , pei
i−1}such that g2
i≡amod pei
i. Then by Chinese
Remainder algorithm there exists g∈ {0, . . . , n −1}such that for all i g ≡gimod pei
i,
thus g2≡amod pei
i, which implies that g2≡amod n. Therefore, for any list of solutions
(g1,...gr)of g2
i≡amod pei
ifor 1 = 1,...r we can (uniquely) create a solution g2≡a
mod n. This implies that Sn(a) = Qr
i=1 Spei
i(a). Now applying (ii), and observing that
gcd(a, n) = 1 implies that pi6 |afor all i, we get that Sn(a) = Qr
i=1 Spi(a)
2. (25 points) Textbook, page 509, problem 18.6(i).
Solution:
(i) Assume that N=peand g= 1. Then by Fermat’s little theorem ap−1≡1 mod p, and
since p−1divides pe−1 = N−1, we also have that aN−1≡1 mod p. Thus pdivides
gcd(aN−1−1, N ), so g6= 1. Note that since ais a Fermat witness, aN−16= 1 mod N, there-
fore Ndoesn’t divide aN−1−1, so gcd(aN−1−1, N )6=N.
3. (35 points) Textbook, page 510, problem 18.12(i)
Solution:
INPUT: An odd integer N≥3and a number L∈Nsuch that either L=N−1(the default
value) or it satisfies aL≡1 mod Nfor all a∈Z∗
N.
OUTPUT: Either "composite", or a set P={p:p|N}where each p∈Pdivides Nand
is prime with probability >1/2. In case Nis a Carmichael number and Lis the default
value, then a set Pis returned.
1. choose a∈ {2, . . . , N −2}uniformly at random
2. g←gcd(a, N );
if g > 1then goto line 7
3. write L= 2kmwith k, m ∈Nand modd.
b0←ammod N(computed using the repeated squaring algorithm)
if b0= 1 then return {N}
1
pf2

Partial preview of the text

Download MA 522 Fall 2008 Homework Solutions: Number Theory Problems - Prof. Agnes Szanto and more Assignments Mathematics in PDF only on Docsity!

Homework 6 Solutions

MA 522 Fall 2008

  1. (25 points) Textbook, page 276, problem 9.40 (i) and (iii).

Solution: (i) Zp is a field, therefore the polynomial x^2 − a has at most two roots in Zp. If p = 2 then g = a is the only solution, so S 2 (a) = 1. If p|a then g^2 = a mod p if and only if p|g, so Sp(a) = 1. If 2 6 = p 6 |a then if g^2 = a mod p then (−g)^2 = a mod p, so the num- ber of solutions is even, either 0 or 2. Bothe cases are possible, e.g. S 5 (2) = 0 but S 5 (1) = 0.

(iii) Assume gcd(a, n) = 1. If there exists i such that Spei i(a) = 0, then Sn(a) = 0, otherwise we have that g^2 ≡ a mod n implies that g^2 ≡ a mod pei^. Assume that for each 1 ≤ i ≤ r Spei i(a) > 0 , and take gi ∈ { 0 ,... , pe i i− 1 } such that g i^2 ≡ a mod pe i i. Then by Chinese Remainder algorithm there exists g ∈ { 0 ,... , n − 1 } such that for all i g ≡ gi mod pe i i, thus g^2 ≡ a mod pe i i, which implies that g^2 ≡ a mod n. Therefore, for any list of solutions (g 1 ,... gr) of g^2 i ≡ a mod pe i ifor 1 = 1,... r we can (uniquely) create a solution g^2 ≡ a mod n. This implies that Sn(a) =

∏r i=1 Spei i(a).^ Now applying (ii), and observing that gcd(a, n) = 1 implies that pi 6 |a for all i, we get that Sn(a) =

∏r i=1 Spi (a)

  1. (25 points) Textbook, page 509, problem 18.6(i).

Solution: (i) Assume that N = pe^ and g = 1. Then by Fermat’s little theorem ap−^1 ≡ 1 mod p, and since p − 1 divides pe^ − 1 = N − 1 , we also have that aN^ −^1 ≡ 1 mod p. Thus p divides gcd(aN^ −^1 − 1 , N ), so g 6 = 1. Note that since a is a Fermat witness, aN^ −^1 6 = 1 mod N , there- fore N doesn’t divide aN^ −^1 − 1 , so gcd(aN^ −^1 − 1 , N ) 6 = N.

  1. (35 points) Textbook, page 510, problem 18.12(i)

Solution: INPUT: An odd integer N ≥ 3 and a number L ∈ N such that either L = N − 1 (the default value) or it satisfies aL^ ≡ 1 mod N for all a ∈ Z∗ N. OUTPUT: Either "composite", or a set P = {p : p|N } where each p ∈ P divides N and is prime with probability > 1 / 2. In case N is a Carmichael number and L is the default value, then a set P is returned.

  1. choose a ∈ { 2 ,... , N − 2 } uniformly at random
  2. g ← gcd(a, N ); if g > 1 then goto line 7
  3. write L = 2km with k, m ∈ N and m odd. b 0 ← am^ mod N (computed using the repeated squaring algorithm) if b 0 = 1 then return {N }

1

  1. for 1 ≤ i ≤ k do bi ← b^2 i− 1 mod N
  2. if bk = 1 then j ← min{i : bi+1 = 1} else return "composite"
  3. g ← gcd(a, N ); if g = 1 or g = N then return {N } else goto line 7
  4. call the algorithm recursively with input g and L, and with input N/g and L. If either of them returns composite then return "composite". Otherwise, they return sets P 1 and P 2 , respectively.
  5. return P 1 ∪ P 2

Correctness: note that when the original Algorithm 18.5 returned "probably prime", then we return the set with one element {N }, and there we proved that in this case N was a prime with probability at leat 1 / 2. This implies that all elements in the set P are prime with probability at least 1 / 2. Clearly, the elements of P divide N. Also note that the above algorithm returns "composite" iff either in line 5 bk = aL^6 ≡ 1 mod N , or this happens recursively for a proper divisor g of N. If L satisfies aL^ ≡ 1 mod N for all a ∈ Z∗ N then this also implies that aL^ ≡ 1 mod g for any divisor g of N. Therefore, when we call recursively the algorithm with input a divisor g|N and L, then we will have for all a ∈ Z∗ g that aL^ ≡ 1 mod g, thus L satisfies the condition of the input specification and none of the recursive calls will return “composite". This implies that if the algorithm returns "composite" then L must be the default value N − 1 , and N is a composite number by Fermat’s little theorem. Finally, if N is a Carmichael number and L = N − 1 , then for all a ∈ Z∗ N aL^ ≡ 1 mod N. As we argued above, the algorithm in this case will not return “composite", but a set P with elements which are primes with probability at least 1 / 2.

Complexity: Each execution of the above algorithm, without the recursive call has the same complexity as Algorithm 18.5, which is O(log N M(log N )) word operations. There are at most log 2 N recursive calls of the algorithm, since there are at most log 2 N distinct prime divisors of N. Thus the total complexity is at most O(log^2 N M(log N )).

  1. (25 points) Textbook, page 512, problem 18.22. Solution: (i) Assume that − 1 is a square modulo p, i.e. There exists g ∈ Z∗ p such that g^2 ≡ − 1 mod p. Then g^4 ≡ 1 mod p, and it also implies that ordp(g) = 4. Since gp−^1 equiv 1 mod p by Fer- mat’s little theorem, we get that 4 |p − 1 , as claimed.

(ii) Assume that 4 |p − 1 , and consider a ∈ Z∗ p such that a generates the cyclic group a ∈ Z∗ p.

Then a

p− 2 1 ≡ − 1 mod p, thus for g := a

p− 4 1 we have that g^2 ≡ − 1 mod p, so − 1 is a square mod p. (iii) clear form the definition.