A bank pays you 4.5% interest per year. In addition, you receive |100 as bonus at
the end of the year (after the interest is paid). Find a recurrence for the amount of
money after n years if you invest |2000.
Assignment 1
Due: 6th April 2021 at 5.00 p.m.
Total: 70 marks
1. Using the theorem divisibility, prove the following
a) If a|b , then a|bc ∀a,b,c∈ℤ ( 5 marks)
b) If a|b and b|c , then a|c (5 marks)
2. Using any programming language of choice (preferably python), implement the following algorithms
a) Modular exponentiation algorithm (10 marks)
b) The sieve of Eratosthenes (10 marks)
3. Write a program that implements the Euclidean Algorithm (10 marks)
4. Modify the algorithm above such that it not only returns the gcd of a and b but also the Bezouts coefficients x and y, such that 𝑎𝑥+𝑏𝑦=1 (10 marks)
5. Let m be the gcd of 117 and 299. Find m using the Euclidean algorithm (5 marks)
6. Find the integers p and q , solution to 1002𝑝 +71𝑞= 𝑚 (5 marks)
7. Determine whether the equation 486𝑥+222𝑦=6 has a solution such that 𝑥,𝑦∈𝑍𝑝 If yes, find x and y. If not, explain your answer. (5 marks)
8. Determine integers x and y such that 𝑔𝑐𝑑(421,11) = 421𝑥 + 11𝑦. (5 marks)
a) Determine whether are equivalent without using truth table.
What is the value of x after each of these statements is encountered in a computer program, if x =3 before the statement is reached?
(b) What is the value of x after each of these statements is encountered in a computer program, if x =3 before the statement is reached?
(i) if x +2=5 then x = 3*x +5
(ii) if (x +1=4) OR (2x +2=3) then x = x +1
(iii) if (2x +3=5) AND (3x +4=13) then x = x^2 +x+7
(iv) if (x +1=4) OR (x +2=5) then x = x +1
Write a simple formula that generates the below mentioned terms.
a) 1,2,2,3,4,4,5,6,6,7,8,8,...
b) 1,10,11, 100, 101, 110,111,1000,1001,1010,1011
Let A = {2,4} and B = {6,8,10} and define relations R and S from A to B as follows: For all (x, y) E A ® B, XRy iff x|y, and xSy iff y - 4 = x. State explicitly which ordered pairs are in A x B, R, S, RUS, and RNS
Q.1.Let A={1 2 3 4 5} .Determine the truth value of each of the following statements justify your answers:
(a) (EE x in A)(x+3=10)
(c) (EE x in A)(x+3<5)
(b) (AA x in A)(x+3<10)
(d) o+x in A|(x+3<=7)
Q.1.Let A={1 2 3 4 5} .Determine the truth value of each of the following statements justify your answers: (a) (EE x in A)(x+3=10) (c) (EE x in A)(x+3<5) (b) (AA x in A)(x+3<10) (d) o+x in A|(x+3<=7)
P^~q implies r