Test 3 Preparation

¡Supera tus tareas y exámenes ahora con Quizwiz!

True or False? To compute 13⁴⁰⁹⁶ mod 7 efficiently, you evaluate the quantity 13⁴⁰⁹⁶ (by multiplying out the product of 4096 factors 13) and then apply the division algorithm to it to find the remainder with respect to division by 7.

False 13⁴⁰⁹⁶ is a number with 4563 digits. It is not computationally efficient to do arithmetic with such large numbers. Using fast modular exponentiation, we can find 13⁴⁰⁹⁶ mod 7 using only "small" numbers: 13¹ mod 7 = 6 13² mod 7 = 6² mod 7 = 36 mod 7 = 1. At this point, we can stop because we have reached a value of 1. Applying the square and mod 7 operation again and again will only show us that 13⁴ mod 7 = 1 13⁸ mod 7 = 1 13¹⁶ mod 7 = 1, etc, until we get to 13⁴⁰⁹⁶ mod 7 = 1. Note that even if we had carried out the fast exponentiation algorithm to the end, it would only have taken us 12 steps, because 4096 = 2¹². Observe that the proposed procedure is doubly inefficient. Even if we wanted to explicitly evaluate 13⁴⁰⁹⁶, we would not do this through successive multiplication, but through successive squaring, since the exponent is a power of 2. This way, it takes us only 12, not 4095 multiplications.

True or False? There are positive integers n and m so that 2ᵐ = 3ⁿ.

False 2ᵐ = 3ⁿ is impossible for positive integers n and m due to uniqueness of prime factorization.

True or False? Prime factorization is generally a computationally more efficient way of finding the gcd of two positive integers than using the Euclidean algorithm.

False Generally speaking, the Euclidean algorithm is vastly more computationally efficient than using prime factorization. Finding the prime factorization of two extremely large numbers could take a computer longer than the age of the universe, while the same computer can still find their gcd using the Euclidean algorithm within fractions of a second.

True or False? There is a smallest real number a so that 3ˣx is O(aˣ).

False Let us use the notations f(x) = 3ˣx and g(x) = 3ˣ. f(x) is not O(g(x)) because f(x)/g(x)=x goes to infinity as x goes to infinity. On the other hand, f(x) is O(aˣ) for any real number a > 3. For example, f(x) is O(3.01ˣ). You can see that this is true by considering the quotient again: f(x)/g(x) = (3/a)ˣ·x. 3/a is less than 1, hence (3/a)ˣ goes to zero as x goes to infinity. Exponential decay beats polynomial growth (this is a calculus fact), so even (3/a)ˣ·x still goes to zero. Since 3ˣx is O(aˣ) for all a > 3, but not for a = 3, there is no smallest real number a so that 3ˣx is O(aˣ).

True or False? There is a prime number greater than 10¹⁰⁰.

False There are infinitely many primes; thus, for any given integer n, there must be prime greater than n.

True or False? If p mod 11 = 5 and q mod 11 = 7, then (p + q) mod 11 = 12.

False You can see that this statement cannot be true because remainders with respect to division by 11 are always integers from 0 to 10. The correct modular addition rule requires another application of the mod operator after you have added the individual remainders. If p mod 11 = 5 and q mod 11 = 7, then (p + q) mod 11 = ((p mod 11) + (q mod 11)) mod 11 = (5 + 7) mod 11 = 1.

Find an integer n such that n mod 31 = 9 and -31< n ≤ 0.

-22 Recall that the mod operator is defined through the division algorithm. n mod 31 = 9 means that n = 31q + 9 for some integer q. Substituting this equation into the condition -31< n ≤ 0 we seek to satisfy, we obtain -31< 31q + 9 ≤ 0. This is equivalent to -40 < 31q ≤ -9, or -40/31 < q ≤ -9/31. There is only one integer q between -40/31 and -9/31: q = -1. This n = -31 + 9 = -22.

Evaluate 12¹⁰²⁴ mod 11.

1 You can use fast modular exponentiation, but an easier way is to use 12 mod 11 = 1. Thus, 12¹⁰²⁴ mod 11=1¹⁰²⁴ mod 11=1

Evaluate (23¹²⁴⁵ · 21⁶⁷⁹¹¹) mod 11.

10 23 mod 11=1 21 mod 11=10 10 ≡ -1 mod 11 23¹²⁴⁵ mod 11 = 1 21⁶⁷⁹¹¹ mod 11=10⁶⁷⁹¹¹ mod 11 = (-1)⁶⁷⁹¹¹mod 11 = 10. (23¹²⁴⁵·21⁶⁷⁹¹¹) mod 11=(23¹²⁴ mod 11)·(21⁶⁷⁹¹¹ mod 11) = 1·10=10.

Determine the gcd of 5²·7⁵ and 3·5·7⁹.

5·7⁵

Convert hexadecimal 5A to binary. Enter a string of only the characters 0 and 1. Do not enter leading zeros, commas or any whitespaces.

1011010 Each hex digit becomes 4 binary digits: 5 is 0101 and A is 1010. Thus, 5A is 01011010. Omitting the leading zero, we get 1011010.

How many decimal digits does the number 12⁹⁸⁸⁶⁸ - 1 have?

10669.0 A positive integer n has ⌊ log₁₀n ⌋ + 1 decimal digits. Thus, n = 12⁹⁸⁸⁶⁸ has ⌊ log₁₀12⁹⁸⁸⁶ ⌋ + 1 = ⌊ 9886 · log₁₀12 ⌋ + 1 = 10669 digits. The problem asks us for the number of decimal digits of n - 1. We reason that it would be unlikely that subtracting 1 from a 10669 decimal digit number would reduce its number of digits. In fact, this could only happen if n was the smallest integer with 10669 decimal digits, which is 10¹⁰⁶⁶⁸ = 1000....0000 (1 followed by 10668 digits zero). However, n is a power of 12. A power of 10 has only the prime factors 2 and 5, while a power of 12 has only the prime factors 2 and 3. Thus, n cannot be equal to 10¹⁰⁶⁶⁸ due to uniqueness of prime factorization.

If p and q are distinct primes, then the number of positive divisors of the integer n = p³q² is

12 The positive divisors of n are: 1, p, p², p³, q, pq, p²q, p³q q², pq², p²q², p³q².

Evaluate ((-14 mod 4) + (76 div 5)) mod 3.

2 -14 mod 4 =2 76 div 5=15 (2+15) mod 3=2.

Select the smallest k so that f(x)=x·(lnx)⁴+x² is big-O of O(xᵏ).

2 Both terms are big-O of x², hence their sum is too. Neither is big-O of x, hence their sum can't be big-O of x either.

The product of two numbers is 48 and their gcd is 2. What is their lcm?

24 If a and b are positive integers, then ab = gcd(a,b) · lcm(a,b).

Enter the decimal representation of the hexadecimal number FF.

255 FF in hex equals 15·16+15 = 15·17 = 255.

What is the minimum number of bit shifts required to carry out the binary multiplication 11011011 · 1000101?

3 1000101 has only three digits 1, whereas 11011011 has six. Thus, we can more efficiently carry out the multiplication by using 1000101 as a multiplier: 1000101 · 11011011 = (1 + 100 + 1000000) · 11011011 = 1 · 11011011 + 100 · 11011011 + 1000000 · 11011011 = 11011011 +1101101100 +11011011000000.

Use the Euclidean algorithm to evaluate the gcd of 1002 and 999.

3 1002 = 1*999 + 3 999 = 3*333 + 0. The last non-zero remainder is the gcd, in this case, 3.

Evaluate -45 mod 6.

3 We find the answer by using the division algorithm: -45 = (-8)·6 + 3.

Convert (11011001)₂ to octal.

311 Convert each 3 digit group to octal.

A working knowledge of laws of exponentiation is required for the induction proof you will be expected to write on the test. Check all algebraic identities. 2ⁿ · 3ᵐ = 6ⁿ⁺ᵐ 2ⁿ + 3ᵐ = 5ⁿ⁺ᵐ 2 · 3ᵐ = 6ᵐ 3ⁿ + 3ᵐ = 3ⁿ⁺ᵐ 3ⁿ · 3ᵐ = 3ⁿᵐ 3ⁿ · 3ᵐ = 3ⁿ⁺ᵐ (5ⁿ)ᵐ = 5ⁿᵐ

3ⁿ · 3ᵐ = 3ⁿ⁺ᵐ (5ⁿ)ᵐ = 5ⁿᵐ

If a positive integer has 100 hexadecimal digits with leading digit A, how many binary digits does it have?

400 Each hex digit corresponds to 4 binary digits. This means that a number with 100 hex digits can be expressed with 400 binary digits, including up to 3 leading zeros. Since the first hex digit is A, the first 4 binary digits are 1010, so there are no leading zeros in our count of 400 binary digits.

Find the lowest integer k so that 1⁵ + 2⁵ + 3⁵ + 4⁵ + 5⁵ + ... + n⁵ is O(nᵏ).

6 Let us call 1⁵ + 2⁵ + 3⁵ + 4⁵ + 5⁵ + ... + n⁵ = S(n). Since each base is at most n, we have the inequality S(n) ≤ n⁵ + n⁵ + ... + n⁵ = n·n⁵ = n⁶. Therefore, S(n) is O(n⁶). On the other hand, if n is even, then n/2 + 1 bases in the sum are at least n/2. For example, S(8) = 1⁵ + 2⁵ + 3⁵ + 4⁵ + 5⁵ + 6⁵ + 7⁵ + 8⁵ , which has 5 bases that are at least 4. Thus, for even n, S(n) > (n/2)⁵ + (n/2)⁵ + ... + (n/2)⁵, where we have more than n/2 terms (n/2)⁵ on the right side. Therefore, S(n) > (n/2)⁶ = n⁶ / 64. This means that S(n) cannot be O(n⁵). Another way to see that S(n) cannot be O(n⁵) is to use calculus. By making a Riemann sum diagram, you can see that S(n) is a left sum for the integral of f(x) = x⁵ from x=1 to x=n+1. Since f is decreasing, the left sum overestimates the integral. The value of the integral is 1/6 ( (n+1)⁶ - 1), an order n⁶ function.

Enter the smallest integer n so that the following function is O(xⁿ). f(x)=x²(x³ + 1)+x⁵log(x).

6 The first term is order of x⁵ , hence also big-O of x⁵. The second term is "between" x⁵ and x⁶ in order, hence big-O of x⁶ but not x⁵. That makes the first term negligible, and the sum big-O of x⁶ but not x⁵.

How many digits does the number 3⁸²³⁴⁷ have in base 3?

82348 In base 3, 3⁸²³⁴⁷ is a digit 1, followed by 82347 zeros.

Match each decimal number to its duodecimal (base 12) representation. 10 12 14 11

A 10 12 B

Suppose we are proving a statement P(n) for all positive integers n by induction. Check all true statements. P(n) is the quantity about which we are proving something. We always find P(n+1) by adding n+1 to the statement P(n). The inductive hypothesis is that we have proved P(1) already. The inductive hypothesis is n = k. In the inductive step, we show that n implies n+1. After we assume the inductive hypothesis, we write the statement P(n+1) by substituting n+1 for n. This proves P(n+1) and completes the inductive step. The inductive hypothesis is that P(n) is true for all n. In the base case, we verify that P(1) is true.

In the base case, we verify that P(1) is true.

True or False? All numbers being in duodecimal, A7B times 100 is A7B00.

True

True or False? All numbers being in hexadecimal, when you divide FA3BC by 10, you get the quotient FA3B and the remainder C.

True

True or False? If k is an integer greater than 1, k³ = (1000)ₖ.

True

To verify that 139 is prime, we only need to show that 139 is not divisible by 2, 3, 5, 7 and 11.

True If an integer n>1 has no factors greater than 1 and the square root of n, then it is prime. Since 139 < 144 = 12², the square root of 139 is less than 12. Thus, we only need to test whether 139 is divisible by the primes that are less than 12.

True or False? 5x² is O(x²).

True If the limit of |f(x)|/|g(x)| as x goes to infinity exists, then f(x) is O(g(x)). In particular, if f(x)/g(x) is a constant, then f(x) is O(g(x)). Here, the quotient is a constant 5.

Knowing that 5851, 5857, 5861 and 5867 are prime, we can be certain that 5851 · 5867 ≠ 5857 · 5861 without evaluating the two products.

True This is due to uniqueness of prime factorization.

True or False? x³ is O(3ˣ).

True Any polynomial function is big-O of any increasing (base > 1) exponential function.

True or False? We can block-convert from octal (base 8) to hexadecimal (base 16) by grouping the octal digits into pairs of 2, and converting each 2-digit octal number into a hexadecimal number.

Two octal digits represent a number from 0 to 63, which can be represented by one base 64 digit, but not by one base 16 digit.

Check all functions f(x) that are Ω(x²).

f(x) = log(xˣ) Correct! f(x) = x³/2 + x² Correct! f(x) = ⌊x+2⌋ · ⌈x⌉ f(x)=2x1.9 +2x-1.9 Correct! f(x) = (x⁴+2x+3)/(x²-2) Correct! f(x) = (x⁵+2x+3)/(x²-2) Correct! f(x) = x² · log(x) Correct! f(x) = 2ˣ +x²

Check all functions f(x) that are O(x²). f(x) = log(xˣ) f(x) = x³/2 + x² f(x) = ⌊x+2⌋ · ⌈x⌉ f(x)=2x1.9 +2x-1.9 f(x) = (x⁴+2x+3)/(x²-2) f(x) = (x⁵+2x+3)/(x²-2) f(x) = x² · log(x) f(x) = 2ˣ +x²

f(x) = ⌊x+2⌋ · ⌈x⌉ f(x)=2x1.9 +2x-1.9 f(x) = (x⁴+2x+3)/(x²-2) f(x) = log(xˣ)

If f(x) is O(x³) and g(x) is O(x⁴), then what is the best we can say about f(x)+g(x)? Find the "lowest" big-O estimate that is guaranteed by the given information.

f(x)+g(x) is O(x⁴).

If f(x) is O(x³) and g(x) is O(x⁴), then what is the best we can say about f(x)·g(x)? Find the "lowest" big-O estimate that is guaranteed by the given information.

f(x)·g(x) is O(x^12).

Find a big-O estimate of f(x)=(3x² + xlog(x²) + x²log(x²))·(πx³ + 2x + 4) + (x² + x⁴log(x)) such that in your estimate f(x) is O(g(x)) and g(x) is a simple function of the smallest order.

g(x)=x⁵log(x) The big-O estimate of a sum is the big-O extimate of the largest function. The big-O estimate of a product is the product of the big-O estimates.

Given an increasing big-O order of the functions. This means that f1 is O(f2), f2 is O(f3), etc. n! log(n) n n^2 n*log(n)

log(n) n n log(n) n^2 n!


Conjuntos de estudio relacionados

CH 13 Admission, Transfer, Discharge Practice Questions

View Set

Nutrition lesson 1 quiz & Chapter 1 Overview of nutrition

View Set

Hepatobiliary, Pancreatic, and infection - Nurs 220 Exam 2

View Set

Economics - 2022 Semester 1 Exam Review

View Set

Discussion Quiz 9 RNA Processing

View Set

NURS 3108 - Chapter 8 Communication Skills EAQs

View Set

Health Assessment PrepU Chapter 1

View Set