Algorithms & Data Structures
assessed Exercise 2 2
- (a) [4]Show that if n divides m where m and n are positive integers greater than 1, then
a ≡ b (mod m) implies a ≡ b (mod n) for any positive integers a and b.
(b) [3]Show that a·c ≡ b·c (mod m) with a, b, c and m integers with m≥2 does not
imply a ≡ b (mod m).
(c) [3]Using the Euclidean Algorithm, find gcd(3084, 1424). Show your working.
- [5]A company has a contract to cover the four walls, ceiling, and floor of a factory building
with fire-retardant material. The building is rectangular where of width 280m, length
336m and height 168m. Square panels can be manufactured in any size of whole metres.
For safety reasons, the building must be covered in complete panels (i.e. panels cannot
be cut). What is the minimum number of equally sized square panels that are required
to line the interior of the building? Explain your answer.
- [5]Prove that least significant digit of the square of an even integer is either 0, 4, or 6.
Hint: considering splitting into cases where integers are of the form a·k+b or −(a·k+b)
for k ∈ N where a and b are fixed for a given case, b varies over the cases and the least
significant digit of the integer depends on only b.
Note: the least significant digit of an integer is the digit farthest to the right in a
integer. For example, the least significant digits of 1007 and 26 are 7 and 6 respec-
tively.
- [5]Use mathematical induction to show that for any n ∈ N, if n ≥ 2, then
nY
i=2
1 − 1
i2
= n+1
2·n .
- [5]Use mathematical induction to show that 2 divides n2 − n for all n ∈ N.