Problem 1: --------- n = 86. Rightmost bit = 0 n = 43. Rightmost bit = 1 n = 21. Rightmost bit = 1 n = 10. Rightmost bit = 0 n = 5. Rightmost bit = 1 n = 2. Rightmost bit = 0 n = 1. Rightmost bit = 1 n = 0. Algorithm terminates. Therefore binary equivalent of 86 is 1010110 Problem 2: --------- (a) gcd(96, 36) = gcd(60, 36) = gcd(36, 24), gcd(24, 12) = gcd(12, 12) = 12 gcd(63, 27) = gcd(36, 27) = gcd(9, 27) = gcd(18, 9) = gcd(9, 9) = 9 (b) Algorithm in pseudocode ----------------------- 1. Let m and n denote the input numbers. 2. If m and n are equal, then output m and stop. 3. If m is greater than n, then replace m by m - n. 4. If m is less than n, then replace n by n - m. 5. Go to Line 2. Problem 3 --------- (a) Decimal Ternary 0 0 1 1 2 2 3 10 4 11 5 12 6 20 7 21 8 22 9 100 10 101 11 102 12 110 13 111 14 112 15 120 16 121 17 122 18 200 19 201 (b) The last digit of the ternary equivalent of a decimal number n is equal to the remainder we get when we divide n by 3. (c) Let m = trunc(n/3). If we take the ternary equivalent of n and remove the last ``digit,'' we get the ternary equivalent of m. (d) Pseudocode. 1. Read input into a variable called n. 2. If n equals 0, we are done - just print 0 and stop. 3. Otherwise, repeat the following steps (4 and 5) until n becomes 0 4. Output n % 3 (i.e., the remainder when n is divided by 3) 5. Replace n by n // 3 (i.e., the truncated value of n divided by 3) This produces the answer digit-by-digit, right to left.