Lecture 15: Midterm

William Stein

Math 124 Harvard University Fall 2001

Contents

1 Introduction 1

2 The Midterm Exam 1

3 Abbreviated Solutions 3

1 Introduction

The midterm examination took place on October 17 at 11am. Twenty two students had 52 minutes to do complete all of these problems with no external aids such as a calculator or notes. Happily, 11 students earned A’s (with 3 perfect scores!); unfortunately, 7 students received a D.

2 The Midterm Exam

Justify your answers. If you do a computation by “pure thought”, explain those pure thoughts.

1. (5 points) Prove that a positive number n is divisible by 11 if and only if the alternating sum of the digits of n is divisible by 11.

2. Let φ : ℕ → ℕ be the Euler φ function.

(i) (3 points) Find all natural numbers n such that φ(n) = 1.

(ii) (2 points) Do there exist natural numbers m and n such that φ(mn) ≠ φ(m) · φ(n)?

3. (6 points) Nikita and Michael decide to agree on a secret encryption key using the Diffie-Hellman key exchange protocol. You observe the following:

• Nikita chooses p = 13 for the modulus and g = 2 as generator.

• Nikita sends 6 to Michael.

• Michael sends 11 to Nikita. What is the secret key?

4. Consider the RSA public-key cryptosystem defined by (n, e) = (77, 7). (i) (3 points) Encrypt the number 4 using this cryptosystem. (ii) (3 points) Find an integer d such that ed ≡ 1 (mod φ(n)).

5. (5 points) How many natural numbers x < 2^{13} satisfy the equation

x^{2} ≡ 5 (mod 2^{13} − 1)?

(You may assume that 2^{13} − 1 is prime.)

6. (10 points) Which of the following systems of equations have at least one solution? Briefly justify your answers.

(a) {x ≡ 1 (mod 3) \atop x ≡ −1 (mod 9)}  (b) 2x ≡ 1 (mod 1234567891011121314151)
(c) {x^{2} ≡ 5 (mod 29) \atop x^{2} ≡ 3 (mod 47)}  (d) {x ≡ 3 (mod 29) \atop x ≡ 5 (mod 47)}
(e) {x^{2} ≡ 3 (mod 29) \atop x^{2} ≡ 5 (mod 47).}

7. (5 points) Find the natural number x < 97 such that x ≡ 4^{48} (mod 97). (You may assume that 97 is prime.)

3 Abbreviated Solutions

1. We use that 10 ≡ −1 (mod 11) and facts about modular arithmetic. Write n = ∑_{i=0}^{r} d_{i}10^{i}. Then n ≡ ∑_{i=0}^{r}(−1)^{i}d_{i} (mod 11), so n ≡ 0 (mod 11) if and only if the alternating sum of the digits ∑(−1)^{i}d_{i} is congruent to 0 modulo 11.

2. For the first part, the answer is n = 1, 2. On a previous homework we proved that n = 1, 2 are the only n such that φ(n) is odd. For the second part, the fact that φ is multiplicative means that if gcd(m, n) = 1 then φ(mn) = φ(m)·φ(n). When gcd(m, n) ≠ 1 this implication can fail; for example,

2 = φ(2 · 2) ≠ φ(2) · φ(2) = 1.

3. Since 2^{n} ≡ 6 (mod 13), a table of powers of 2 modulo 13 quickly reveals that n must be 5 (we solve the discrete log problem easily in this case since 13 is so small). Likewise, since g^{m} ≡ 11 (mod 13) we see that m = 7. The secret key is s = 7 since g^{nm} = 2^{35} ≡ 2^{11} ≡ 7 (mod 13). (Some people who attempted this problem incorrectly thought the secret key should be g^{n} · g^{m} = g^{n+m}.)

4. (a) We must compute 4^{7} (mod 77). Working modulo 77, we have that

4^{7} = 64 · 64 · 4 = 13^{2} · 4 = 169 · 4 = 15 · 4 = 60,

so 4 encrypts as 60.

(b) First, φ(n) = φ(77) = φ(7)·φ(11) = 6·10 = 60. (Some people incorrectly thought that φ(n) = 77 for some reason.) We then use the extended Euclidean algorithm to find an integer e such that 7e ≡ 1 (mod 60). We find that 2 · 60 − 17 · 7 = 1, so e = −17 is a solution.

5. First we use the law of quadratic reciprocity to decide whether or not there is a solution. We have

(\frac{5}{2^{13} − 1}) = (−1)^{2·(2^{13}−2)/2} (\frac{2^{13} − 1}{5}) = (\frac{1}{5}) = 1,

so the equation x^{2} ≡ 5 (mod 2^{13} − 1) has at least one solution a. Since the polynomial x^{2} − 5 has degree two and 2^{13} − 1 is prime, there are at most 2 solutions. Since −a is also a solution and a ≠ 0, there are exactly two solutions.

6. (a) has no solutions because x ≡ −1 (mod 9) implies that x ≡ −1 (mod 3). (b) has a solution because gcd(2, 1234567891011121314151) = 1. (c) has a solution because (\frac{5}{29}) = (\frac{3}{47}) = 1 so there are a and b such that a^{2} ≡ 5 (mod 29) and b^{2} ≡ 3 (mod 47); the Chinese Remainder Theorem then implies that there is an x such that x ≡ a (mod 29) and x ≡ b (mod 47). (d) has a solution by the Chinese Remainder Theorem, since gcd(29, 47) = 1. (e) has no solution since (\frac{3}{29}) = −1, so the first of the two equations doesn’t even have a solution.

7. Since 97 is prime, Fermat’s Little Theorem implies that 4^{48} = 2^{96} ≡ 1 (mod 97).