MA161 Assignment 2
MA161 Assignment 2
Semester 2, 2022
Group members
Name ID #
Avishek Nisheel S11172663
Maharaj
Kirtik Kaushak S11172571
Prakash
Roneel Din S11171983
Kumar
Question 1 (a)
Prime Number
A prime number is a number that is only Divisible by 1 and the number itself.
Composite Number
A composite number is a number that can be divided by 1 and other numbers.
E.g. 6
6/2 =3
6/3 =2
6/6 =1
Thus 6 is a composite number and has factors of 1,2,3,6.
Since 512, is only divisible by 1, thus, 512 is prime.
Question 1(b)
52100 / 2 = 26050
26050 / 2 = 13025
13025 / 5 = 2605
2605 / 5 = 521
521 / 521 = 1
Question 2(a)
n2 ≡ 0(mod 4).
STEP1:
Assume n is even If m is even, then there exists k ∈ Z such that n = 2k.
STEP2:
Then n2 = 4k2, so 4| n2 and hence n2 ≡ 0(mod 4).
Or
n2 ≡ 1(mod 4).
= n2 − 5n + 3 > 0
= (52) + 5(5) + 3 >= 0
= 53 > 0
Step2: n = k
ASSUME P(k) is true k2 – 5k + 3 > 0 where n>4 = (k-2) (k-3)>=0
Step 3: n=K+1
Question 3
6314.
Thus, 110011001100 to octal conversion is equal to 6314
Hexadecimal expansion of 1100110011002.
Question 4 (a)
178 ÷ 67 = 2 + 44
67 ÷ 44 = 1+ 23
44 ÷ 23 = 1+21
23 ÷ 21 = 1+2
2 ÷ 1 = 2+0
Question 4 (b)
1 = 1 × 21 – 10 × 2
1 = 1 × 21 – 10 × (23 – 1 × 21)
1 = -10 × 23 + 11 × 21
1 = -10 × 23 + 11 × (44 – 1 × 23)
1 = 11 × 44 – 21 × 23
1 = 11 × 44 – 21 × (67 – 1 × 44)
1 = -21 × 67 + 32 × 44
1 = -21 × 67 + 32 × (178 – 2 × 67)
1 = 32 × 178 – 85 × 67
178 × x + 67 × y = 1
Has a solution of (x, y)= (32, -85)
Question 4 (c)
Gcd=1
178/67 = 2 R 44
67/44 = 1 R 23
178-2(67)
67-1(44)
Question 4 (d)
Gcd = 1
Question 4 (e)
178-2(67-1(44) = 32
recursive algorithm for finding the sum of the first n even positive integers.
Question 5 (b)
Input parameters & values:
= 5/2 x (2 + 10)
= (5 x 12)/ 2
= 60/2
2 + 4 + 6 + 8 + 10 = 30
26+26+10+4 = 66 characters
(a)
For 6-digit password: 667
For 7-digit password: 668
For 8-digit password: 669
For 9-digit password: 6610
Question 6(b)
A password has no special characters means on each place we can put 66 - 4 = 62
characters.
66^7+66^8+66^9+66^10 - 62^7-62^8-62^9-62^10 =
1.59x1018 – 8.53 x 1017
= 7.37 x 1017 different passwords with at least one occurrence of at least one special
characters available
Question 6(c)
(23,370,1118 years if take leap years into account). calculations have some inaccuracy.