Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

MATH7861 (S1, 2023)

Assignment 2

Due: 4pm on 3 April 2023

All assignments in this course must be submitted electronically and SUBMITTED AS A SINGLE PDF FILE. Prepare your assignment solutions using Word, LaTeX, Windows Journal, or other application, ensuring that your name, student number and tutorial group number appear clearly at the top to the first page, and then save your file in pdf format.  Alternatively, you may handwrite your solutions and scan or photograph your handwritten work to create a pdf file.  Make sure that your pdf file is legible and that the file size is not excessive. Use the assignment submission link in Blackboard to submit the pdf file.

1. (16 marks) Prove or disprove each of the following statements. (a) For all d ∈ Z+ , there exists n ∈ Z such that ⌊ ⌋ = ⌈ ⌉ . (b) ∀n ∈ Z, if (3n + 2)2  ̸≡ 4  (mod 6) then n is odd.

(c) ∀n ∈ Z, if (2n + 1) ≡ 1  (mod 3) then n is odd.

(d) For all m,n,d ∈ Z+ , if m | n and d ∤ n then d ∤ m.

(e) For all real numbers r and s, if is irrational then r is irrational or s is irrational.

2. (2 marks) Use the Euclidean Algorithm to compute the greatest common divisor of −8765 and

1234. Show all of your steps.

3. (2 marks) Let n and m be positive integers, where the unique prime factorisations of n and m are given by:

n = 2 · 3a · 72  · 13b  for some fixed a,b ∈ Z+

m = 3k · 7 · 11 · 13for some fixed k,ℓ ∈ Z+

If a < k and b > ℓ, determine the greatest common divisor of n and m and the least common multiple of n and m.

4. (5 marks) Consider the sequence {bn }n1  defined recursively as

b1  = 1,    b2  = 3,    b3  = 7   and   bk  = 2bk1 + bk3  for each integer k ≥ 4. Use strong mathematical induction to prove that bn  ≤ 3n1  for each integer n ≥ 1.

The following questions are based on material in Section 4.8 (in the 4th edition) or 4.10 (in the 5th edition) Application:  Algorithms of the course textbook.  See also Tutorial 5. You may use Lemmas and Theorems that were proved in lectures as known facts.

5. (10 marks) A Boolean variable is a variable that takes a value in the set  {0, 1}, where

0 represents FALSE and 1 represents TRUE. Consider the algorithm given in the box below, using the same style of pseudocode as seen in the section Application: Algorithms of the course textbook. You may assume:

.  sqrt(n) gives the square root of a non-negative number n;

.  floor(x) gives the value of「x⌋;

.  n  mod d gives the remainder when n is divided by d (using the Division Algorithm, for example) for n,d ∈ Z+ ;

.  (x = y) is a Boolean expression which is 1 (ie TRUE) if x and y have the same value, and

is 0 (ie FALSE) otherwise.  Note that this differs from the notation x := y used to assign variable x the value y;

.  the terms and and or in pseudocode operate the same as ∧ and ∨ .

Notes:  The indentation of the conditional statement (if-then-else) is presented as in Section 4.8 (4th edition) / 4.10 (5th edition) of the course textbook.  Recall that“Iteration Number 0” is meant to keep track of the initial values of the variables in an algorithm (eg see Tutorial 5).

Input: n (an integer greater than 1)

Algorithm Body:

s := floor(sqrt(n)), T := 0, d := 2, A := 1,

while (d s and A = 1)

T := n mod d

if (T = 0)

then A := 0

else d := d + 1

end while

Output: A

(a) Construct a trace table to trace the action of this algorithm for the following inputs, and

in each case, state the output.

(i) n = 41

(ii) n = 445

(b) Explain what each step of the algorithm is doing. How should we interpret the meaning of

the output?

(c) How many iterations of the while loop will run if the algorithm is given input n = 2431? (Do not use a trace table.)