0% found this document useful (0 votes)
596 views4 pages

HMWK 1 Solutions PDF

This document contains solutions to 6 problems related to number theory and modular arithmetic. Problem 1 involves using the extended Euclidean algorithm (EEA) to solve linear Diophantine equations and explains that if a solution exists, there are infinitely many solutions. Problem 2 uses the EEA to find modular inverses and solve a congruence. Problems 3-5 use the EEA and properties of modular arithmetic to find all solutions to congruences and compute greatest common divisors (GCDs). Problem 6 analyzes the GCD of Fibonacci numbers and provides a general solution for the GCD of two numbers represented by a sequence of digits.

Uploaded by

pindari saab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
596 views4 pages

HMWK 1 Solutions PDF

This document contains solutions to 6 problems related to number theory and modular arithmetic. Problem 1 involves using the extended Euclidean algorithm (EEA) to solve linear Diophantine equations and explains that if a solution exists, there are infinitely many solutions. Problem 2 uses the EEA to find modular inverses and solve a congruence. Problems 3-5 use the EEA and properties of modular arithmetic to find all solutions to congruences and compute greatest common divisors (GCDs). Problem 6 analyzes the GCD of Fibonacci numbers and provides a general solution for the GCD of two numbers represented by a sequence of digits.

Uploaded by

pindari saab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CS378, Spring 2023

Homework 1 – Solutions

Problem 1

(a) Find integers x and y such that 1 = 26x + 55y. If you think the problem has no solutions, explain why.

We will use the EEA:

i qi ri xi yi
0 26 1 0
1 55 0 1
2 0 26 1 0
3 2 3 −2 1
4 8 2 17 −8
5 1 1 -19 9
6 2 0

The answer is x = −19 and y = 9.

(b) Find integers x and y such that 1 = 28x + 105y. If you think the problem has no solutions, explain why.

The problem has no solution because for every integers x and y, 7|28x + 105y. However, 7 6 |1.

(c) If you found a solution in (a) or (b), can you also find another solution to that problem? If not - why not?
If yes, what is it?

We found a solution in (a). That is, we have integers x and y such that 1 = 26x + 55y. Observe that it
follows that 1 = 26x + 26 · 55 − 26 · 55 + 55y = 26(x + 55) + 55(y − 26). Thus, if a pair (x, y) is a solution,
so is the pair (x + 55, y − 26). In our case, x0 = 36 and y 0 = −17 is also a solution (and, in fact, there are
infinitely many solutions).

Problem 2

(a) Find 28−1 (mod 55)


First, we use the EEA to find integers x and y such that 1 = 28x + 55y. It is possible because
gcd(28, 55) = 1.

i qi ri xi yi
0 28 1 0
1 55 0 1
2 0 28 1 0
3 1 27 −1 1
4 1 1 2 −1
5 27 0
We obtain x = 2. Thus, 1 ≡ 28 · 2 (mod 55) and so, 28−1 ≡ 2 (mod 55). The answer: 2.

(b) Solve 28x + 11 ≡ 6 (mod 55)

Subtract 11 from both sides to get 28x ≡ −5 (mod 55). Multiplying both sides by 28−1 = 2 (mod 55) we
obtain x ≡ 2 · (−5) ≡ −10 ≡ 45 (mod 55). The solution: 45.

Problem 3

(a) Find all integer solutions of 12x ≡ 52 (mod 238).

We have gcd(12, 238) = 2. Since 2|52, we reduce our equation to

6x ≡ 26 (mod 119).

We now use the EEA to find that 6−1 ≡ 20 (mod 119). Thus, x ≡ 20 · 26 ≡ 44 (mod 119). It follows that
every solution to the original equation is an integer of the form 44 + 119k, where k ∈ Z.

(b) Find all integer solutions of 12x ≡ 26 (mod 238).

We have gcd(12, 238) = 2. Since 2|26, we reduce our equation to

6x ≡ 13 (mod 119).

We know that 6−1 ≡ 20 (mod 119). Thus, x ≡ 20 · 13 ≡ 22 (mod 119). It follows that every solution to
the original equation is an integer of the form 22 + 119k, where k ∈ Z.

Problem 4

(a): Use the EA to compute gcd(1870, 359) and gcd(359, 273).

0 1870
1 359
2 75
3 59
4 16
5 11
6 5
7 1
8 0

Thus, gcd(1870, 359) = 1.


0 359
1 273
2 86
3 15
4 11
5 4
6 3
7 1
8 0

Thus, gcd(359, 273) = 1.

(b): Using the results of (a) and the fact that 1870 = 2 · 5 · 11 · 17 and 273 = 3 · 7 · 13, prove that 359 is
prime.

If 359 has a divisor other than 1 and 359, it must have a prime divisor smaller than or equal to b 359c = 18.
Thus, one of 2, 3, 5, 7, 11, 13, 17 would have to divide 359. As gcd(359, 273) = 1, none of 3, 7, 13 divides
359, and if one of the remaining primes 2, 5, 11, 17 divided 359, we would have gcd(1870, 359) > 1, a
contradiction. Thus, 359 is a prime.

Problem 5

(a): Compute gcd(12317, 10573) (show the results of all iterations of the Euclid Algorithm).

0 12317
1 10573
2 1744
3 109
4 0

Thus, gcd(12317, 10573) = 109.

(b): Using the result from (a), factor 12317 and 10573 into products of prime.

Dividing each integer by 109, we get that 12317 = 109 · 113 and 10573 = 109 · 97. Since 113 and 97 are
prime, the two products are the prime factorizations we are asked to find.

Problem 6

(a): Define the Fibonacci sequence by F1 = 1, F2 = 1 and Fn+1 = Fn + Fn−1 . Use the EA to find
gcd(Fn , Fn−1 ).

Since the sequence is strictly increasing for n ≥ 2, we see that Fn mod Fn−1 = Fn−2 , for every n ≥ 2.
Thus, the EA computation of gcd(Fn , Fn−1 ) looks like this:
0 Fn
1 Fn−1
2 Fn−2
···
n−2 F2 (=2)
n−1 F1 (= 1)
n 0

Thus, gcd(Fn , Fn−1 ) = 1.

(b): Find gcd(22 . . . 2, 22 . . . 2), where the first integer’s decimal representation is a sequence of 38 2’s, and
the second integer’s decimal representation is a sequence of 21 2’s.

Based on (c), the answer is an integer consisting of gcd(38, 21) 2s. Since gcd(38, 21) = 1, the answer is 2.

(c) Solve (b), in the general case when the first integer is a sequence of n 2’s and the second integer isd a
sequence of m 2’s.

Assume x is an integer whose decimal representation is a sequence of n 2’s. Assume also that y is an integer
whose decimal representation is a sequence of m 2’s. Without loss of generality, we may assume that n ≥ m.
Assume that k = n (mod m). Then n = qm + k, for some non-negative integer q. Moreover, 0 ≤ k < m.
Finally, define z to be an integer whose decimal representation is a sequence of qm 2’s. We can show that
y|z. Indeed,
z = (10k(q−1) + 10k(q−2) + . . . + 10k + 100 )y.

Let w = z · 10k . Then w is an integer whose decimal representation is a sequence of n − qm 2’s followed
by k 0’s. Let u be an integer whose decimal representation consists of k 2’s ((0, if k = 0). Then

x = w + u = 10k z + u = 10k (10k(q−1) + 10k(q−2) + . . . + 10k + 100 )y + u.


Since u < y, It follows that u = x (mod y).
Thus, when we run the Euclid algorithm on x and y, we generate a sequence of integers, each a sequence of
2’s, with the number of 2’s given by the integer generated by the Euclid algorithm run on n amd m in the
corresponding iteration.
It follows that gcd(x, y) is a number given by a sequence of gcd(n, m) 2’s.

Your solution must be typed (wordprocessed), and submitted as a pdf document to canvas

You might also like