You are on page 1of 4

# CSI 2101 Discrete Structures Winter 2012

## Prof. Lucia Moura University of Ottawa

Homework Assignment #2 (100 points, weight 5%)
Due: Thursday, March 15, at 1:00pm (in lecture)

## Number Theory and Proof Methods

1. (20 points) We call a positive integer perfect if it equals the sum of its positive divisors
other than itself.
(a) Prove that 6 and 28 are perfect numbers.

We have that 6 = 2 · 3, so the positive divisors of 6 other than itself are 1, 2, and
3. As 1 + 2 + 3 = 6, 6 is perfect.
We have that 28 = 2 · 2 · 7, so the positive divisors of 28 are 1, 2, 4, 7, and 14.
1 + 2 + 4 + 7 + 14 = 28, so 28 is perfect.
(b) Prove that if 2p − 1 is prime, then 2p−1 (2p − 1) is a perfect number.

The positive divisors of 2p−1 (2p − 1) other than itself for 2p − 1 prime are all the
numbers
Pn i of the form 2i for 0 ≤ i ≤ p−1, and 2j (2p −1) for 0 ≤ j < p−1. Note that
n+1
i=0 2 = 2 − 1 for any positive integer n: this can be seen by thinking of the
. .0} −1.
sum as the binary number |11.{z. .1}, which is just the binary expression 1 |0.{z
n n
Thus, taking the sum of these positive divisors gives:
p−1 p−2
X X
i
2 + 2j (2p − 1) = (2p − 1) + (2p − 1)(2p−1 − 1)
i=0 j=0

## = (2p − 1)(1 + (2p−1 − 1))

= (2p − 1)2p−1
Thus, for 2p − 1 prime, we have that 2p−1 (2p − 1) is perfect.
2. (20 points)
(a) Find the inverse of 19 modulo 141, using the Extended Euclidean Algorithm.

## We apply the Euclidean Algorithm to 19 and 141:

141 = 7 · 19 + 8
19 = 2 · 8 + 3
8=2·3+2
3=1·2+1

1
Thus, gcd(19, 141) = 1, which is a requirement for the inverse to exist. Now we
proceed with the rest of the Extended Euclidean algorithm to express gcd(19, 141) =
19s + 141t for integers s, t. Then we have that s is the inverse of 19 modulo 141:

1=3−1·2
= 3 − (8 − 2 · 3)
= −8 + 3 · 3
= −8 + 3(19 − 2 · 8)
= 3 · 19 − 7 · 8
= 3 · 19 − 7(141 − 7 · 19)
= −7 · 141 + 52 · 19

## Thus, the inverse of 19 modulo 141 is 52.

(b) Solve the congruence 19x ≡ 7 (mod 141), by specifying all the integer solutions x
that satisfy the congruence.

We have that the inverse of 19 modulo 141 is 52, so we can multiply both sides
of the equation by 52:

## 19x ≡ 7 (mod 141)

52 · 19x ≡ 52 · 7 (mod 141)
x ≡ 82 (mod 141)

Thus, the integer solutions that satisfy the congruence are of the form 82 + 141i
for all integers i.

## 3. (20 points) Find all solutions of the congruence x2 ≡ 16 (mod 105).

Hint: find all the solutions of this congruence modulo 3, modulo 5 and modulo 7 and
then use the Chinese Remainder Theorem. Note that each of these equations will have
two solutions so when combining them you can expect 8 different solutions mod 105.

We find all of the solutions x2 ≡ 16 ≡ 1 (mod 3). There are only two nonzero values
modulo 3, namely 1 and 2, and both of these are solutions to the equation.
We then find all solutions x2 ≡ 16 ≡ 1 (mod 5). There are two such solutions, namely
1 and 4.
Finally, we find all solutions x2 ≡ 16 ≡ 2 (mod 7). There are two such solutions,
namely 3 and 4.
For each combination of solutions, we apply the Chinese remainder theorem. We have
that M1 = 105/3 = 35, and an inverse of 35 modulo 3 is 2; M2 = 105/5 = 21, and
an inverse of 21 modulo 5 is 1; and M3 = 105/7 = 15, and an inverse of 15 modulo 7

2
is 1. Then, for every combination a1 , a2 , a3 of solutions with a1 = 1, 2, a2 = 1, 4, and
a3 = 3, 4, we have that the following is a solution to the congruence:
x ≡ a1 · 35 · 2 + a2 · 21 · 1 + a3 · 15 · 1 = 70a1 + 21a2 + 15a3 .

## For a1 = 1, a2 = 1, a3 = 3, this gives x ≡ 31 (mod 105), so x = 31 + 105y for all

integers y.
For a1 = 1, a2 = 1, a3 = 4, this gives x ≡ 46 (mod 105), so x = 46 + 105y for all
integers y.
For a1 = 1, a2 = 4, a3 = 3, this gives x ≡ 94 (mod 105), so x = 94 + 105y for all
integers y.
For a1 = 1, a2 = 4, a3 = 4, this gives x ≡ 4 (mod 105), so x = 4 + 105y for all integers
y.
For a1 = 2, a2 = 1, a3 = 3, this gives x ≡ 101 (mod 105), so x = 101 + 105y for all
integers y.
For a1 = 2, a2 = 1, a3 = 4, this gives x ≡ 11 (mod 105), so x = 11 + 105y for all
integers y.
For a1 = 2, a2 = 4, a3 = 3, this gives x ≡ 59 (mod 105), so x = 59 + 105y for all
integers y.
For a1 = 2, a2 = 4, a3 = 4, this gives x ≡ 74 (mod 105), so x = 74 + 105y for all
integers y.
Thus, these are all of the solutions to the congruence.
4. (20 points)
(a) Use Fermat’s little theorem to compute: 4101 mod 5, 4101 mod 7, 4101 mod 11.

First we compute 4101 (mod 5). We have that a4 ≡ 1 (mod 5) by Fermat’s little
theorem, so:
4101 ≡ 44·25+1 ≡ 4 · (44 )25 ≡ 4 · 125 ≡ 4 (mod 5).
We now compute 4101 (mod 7). We have that a6 ≡ 1 (mod 7) by Femat’s Little
Theorem, which gives:
4101 ≡ 416·6+5 ≡ 45 (46 )16 ≡ 45 116 ≡ 45 (mod 7).
We have that 42 ≡ 16 ≡ 2 (mod 7), so this gives that’:
45 ≡ (42 )2 4 ≡ (22 )4 ≡ 42 ≡ 2 (mod 7).
Finally, we find 4101 (mod 11). We have that 410 ≡ 1 (mod 11) by Fermat’s Little
Theorem, which gives:
4101 ≡ 410·10+1 ≡ 4 · (410 )10 ≡ 4 (mod 11).

3
(b) Use your results from part (a) and the Chinese Remainder Theorem to compute
4101 mod 385. (note that 385 = 5 × 7 × 11).
We have that M1 = 385/5 = 77, and the inverse of 77 modulo 5 is y1 = 3. As
well, M2 = 385/7 = 55, and the inverse of 55 modulo 7 is y2 = 6. Finally,
M3 = 385/11 = 35, and the inverse of 35 modulo 11 is y3 = 6. Thus, by the
Chinese Remainder Theorem, the solution has the form:

## Thus, 4101 ≡ 114 (mod 385).

5. (20 points)
Encrypt the message ATTACK using the RSA cryptosystem with n = 43 · 59 and
e = 13, translating each letter into integers and grouping together pairs of integers, as
done in example 11 in the textbook and in the classnotes.

We have p = 43, q = 59, and n = 2537. Mapping letters to their positions in the
alphabet gives that A has value 1, C has value 3, K has value 11, and T has value 20.
Thus, the messages we want to transmit are AT, which has value 0120; TA, which has
value 2001; and CK, which has value 0311.
To encrypt message M , we calculate C = M e (mod n). Thus, 0120 encrypts to: