Preview

Solving C++

Satisfactory Essays
Open Document
Open Document
345 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Solving C++
Q#1: For each pair of numbers, when the division algorithm is used to divide a by d, what are the quotient q and remainder r?
(a) a = 88, d = 11.
(b) a = −29, d = 9
(c) a = 58237, d = 58168 (actual question is a = 58237, d = 58168 )

Solution:

(a) Because 88 = 11・8 + 0, we have q = 8, r = 0. (The fact that r = 0 says that 11|88.)

(b) Because −29 = 9・(−4) + 7, we have q = −4 and r = 7. (Note that although we can write −29 =9・(−3) + (−2), we cannot use −2 as r because r is not allowed to be negative.)

(c) a = d(q)+r

58237 = 58168(1) + 69

Quotient = 1, Remainder = 69

(c actual) We do not need to perform the exponentiations to find a and d. We need only observe that a is a multiple of d: 58237 = 58168・5869 (recall the rule for exponents: abac = ab+c). Therefore 58237 = 58168・5869 + 0 and we have q = 5869 and r = 0. (6)
Q #2:
a) Prove the following:
∃ an even integer n that can be written in two ways as a sum of two prime numbers.

Solution: Let n = 14. Then 14 = 11 + 3 = 7 + 7 and 3, 7, and 11 are all prime numbers.

b) Suppose that r and s are integers. Prove the following:
∃ an integer k such that 22r + 18s = 2k.

Solution: Let k = 11r + 9s. Then k is an integer because it is a sum of products of integers

2k = 2(11r + 9s), which equals 22r + 18s Q# 3:
The only divisors of 1 are 1 and −1 prove it. (8)

Solution:

Since 1·1 = 1 and (−1)(−1) = 1, both 1 and −1 are divisors of 1. Now suppose m is any integer that divides 1. Then there exists an integer n such that 1 = mn.
By Theorem, either both m and n are positive or both m and n are negative.
If both m and n are positive, then m is a positive integer divisor of 1. By Theorem, m ≤ 1, and, since the only positive integer that is less than or equal to 1 is 1 itself, it follows that m = 1. On the other hand, if both m and n are negative, then, by Theorem, (−m)(−n) = mn = 1. In this case −m is a positive integer divisor of 1,

You May Also Find These Documents Helpful