Solutions to Homework 4

advertisement
CS 205
Introduction to Discrete Structures 1
Spring 2005
Solutions to Homework 4
Due Date: Tuesday 12/12/05
You are supposed to solve within your study group by first thinking about the problems for
yourself, then sharing your ideas with your group members and then splitting up the work
for writing down the detailed solutions. Make sure that every group member knows how to
solve every problem that you hand in. Submit one solution per group and indicate which
group member was responsible for the write up of each problem. Include your names and
your groups number the cover sheet.
Problems marked with a [*] are a littlebit harder and count as extra credit.
Note 1. For any of the given problems make sure that you justify your answers. You must
show how you obtained your solution or argue that your solution is correct. If you fail to
so, you will receive little or no credit for your solution!
Problem 1. (5 pts) Let a = 118300 and let b = 142805.
(a) (3 pts) Compute the prime factorization of a.
Answer
Let us successively try all the primes.
2 | 118300
2 | 59150
3 - 29525
5 | 29575
5 | 5915
7 | 5915
7 - 169
11 - 169
13 | 169
118300 = 2 · 59150
59150 = 2 · 29575
29575 = 5 · 5915
5915 = 5 · 1183
5915 = 7 · 169
169 = 13 · 13
Therefore the prime factorization of a is
a = 118300 = 22 · 30 · 52 · 71 · 110 · 132 .
CS 205
Introduction to Discrete Structures 1
Spring 2005
(b) (3 pts) Compute the prime factorization of b.
Answer
Let us successively try all the primes.
2 - 142805
3 - 142805
5 | 142805
5 - 28561
7 - 28561
11 - 28561
13 | 28561
13 | 2197
13 | 169
142805 = 5 · 28561
28561 = 13 · 2197
2197 = 13 · 169
169 = 13 · 13
Therefore the prime factorization of a is
b = 142805 = 20 · 30 · 51 · 70 · 110 · 134 .
(c) (2 pts) Compute gcd(a, b).
Answer
Since we have the prime factorization of a and b we can compute the gcd(a, b) directly.
gcd(a, b) = 2min(2,0) · 3min(0,0) · 5min(2,1) · 7min(1,0) · 11min(0,0) · 13min(2,4) ·
= 20 · 30 · 51 · 70 · 110 · 132 ·
= 845
(d) (2 pts) Compute lcm(a, b).
Answer
Since we have the prime factorization of a and b we can compute the lcm(a, b) directly.
lcm(a, b) = 2max(2,0) · 3max(0,0) · 5max(2,1) · 7max(1,0) · 11max(0,0) · 13max(2,4) ·
= 22 · 30 · 52 · 71 · 110 · 134 ·
= 19992700
CS 205
Spring 2005
Introduction to Discrete Structures 1
(e) (5 pts) Show that for any integers a and b (not necessarily the ones above)
a · b = gcd(a, b) · lcm(a, b).
Answer
Let the prime factorizations of a and b be given by
a = pa11 · pa22 · . . . · pakk
b = pb11 · pb22 · . . . · pbkk ,
where p1 , . . . , pk are the first k primes.
Now we can compute the product a · b as
a · b = pa11 · pa22 · . . . · pakk · pb11 · pb22 · . . . · pbkk
= pa11 · pb11 · pa22 p2b2 · . . . · pakk · pbkk
= pa11 +b1 · pa22 +b2 · . . . · pakk +bk
Now let us compute the product lcm(a, b) · gcd(a, b) in prime factorization and we will
see that they are equal.
max(a1 ,b1 )
gcd(a, b) · lcm(a, b) = p1
max(a1 ,b1 )
= p1
max(ak ,bk ) · . . . · pk
min(a1 ,b1 )
· p1
max(a1 ,b1 )+min(a1 ,b1 )
= p1
min(a1 ,b1 )
· p1
max(ak ,bk )
· . . . · pk
min(ak ,bk ) · . . . · pk
min(ak ,bk )
· pk
max(ak ,bk )+min(ak ,bk )
· . . . · pk
For any two numbers x and y the sum max(x, y) + min(x, y) = x + y. Therefore
gcd(a, b) · lcm(a, b) = p1a1 +b1 · pa22 +b2 · . . . · pakk +bk
=a·b .
CS 205
Introduction to Discrete Structures 1
Spring 2005
Problem 2. (12 pts) For each of the following statements decide whether they are true or
false. Prove or disprove the following statements.
(a) (3 pts) The sum of two primes is a prime.
Answer
False. Consider the primes p = 3 and q = 5. The sum p + q = 8 is divisible by 2 and
thus not prime.
(b) (3 pts) If p and q are primes, then p + q is composite.
Answer
False. Consider the primes p = 2 and q = 3. The sum p + q = 5 is a prime numbers.
(c) (3 pts) If p and q are primes where p > 2 and q > 2, then p + q is composite.
Answer
True. Consider two primes p and q. Both numbers are odd, i.e. p = 2k+1 and q = 2l+1
for some integer values k and l. Thus the sum p + q = 2k + 1 + 2l + 1 = 2(k + l + 1) is
an even number and therefore composite.
(d) (3 pts) There exist two consecutive primes, each greater than 2.
Answer
False. Consider two consecutive numbers n and n + 1. Either n is even, then n + 1 is
odd or n is odd and n + 1 is even. In either case one of the two numbers is always even
and therefore cannot be a prime greater than 2.
(e) (3 pts) If p and q are primes where p > 2 and q > 2, then p · q + 1 is never prime.
Answer
True. Consider two primes p and q. Both numbers are odd, i.e. p = 2k+1 and q = 2l+1
for some integer values k and l. Now the quantity p · q + 1 = (2k + 1)(2l + 1) + 1 =
4kl + 2k + 2l + 1 + 1 = 2(2kl + k + l + 1) is even and greater than 2. Therefore it cannot
be prime.
CS 205
Introduction to Discrete Structures 1
Spring 2005
(f ) (3 pts) If f (n) = n2 − n + 17, then f (n) is prime for all positive integers n.
Answer
False. Consider f (17) = 172 − 17 + 17 = 289 which is divisible by 17 and therefore not
prime.
CS 205
Introduction to Discrete Structures 1
Spring 2005
Problem 3. (18 pts) For each of the following statements decide whether they are true or
false. Prove or disprove the following statements.
(a) (3 pts) If a ≡ b (mod m) and a ≡ c (mod m), then a ≡ b + c (mod m).
Answer
False. Counterexample m = 3, a = 7, b = 1, c = 4.
(b) (3 pts) If a ≡ b (mod m) and c ≡ d (mod m), then ac ≡ b + d (mod m).
Answer
False. Counterexample m = 3, a = 4, b = 1, c = 2, d = 2.
(c) (3 pts) If a ≡ b (mod m) then 2a ≡ 2b (mod m).
Answer
True. Since a ≡ b (mod m), we know a = k · m + b for some k. Therefore 2a =
2(k · m + b) = (2k) · m + 2b) and so 2a ≡ 2b (mod m).
(d) (3 pts) If a ≡ b (mod m) then a ≡ b (mod 2m).
Answer
False. Counterexample m = 3, a = 1, b = 4.
(e) (3 pts) If a ≡ b (mod m) then 2a ≡ 2b (mod 2m).
Answer
True. Since a ≡ b (mod m), we know a = k · m + b for some k. Therefore 2a =
2(k · m + b) = k · (2m) + 2b) and so 2a ≡ 2b (mod 2m).
(f ) (3 pts) If a ≡ b (mod 2m) then a ≡ b (mod m).
Answer
True. Since a ≡ b (mod 2m), we know a = k · (2m) + b for some k. Therefore
a = (2k) · m + b and thus a ≡ b (mod m).
Download