03-The Fundamentals - Algorithms - Integers (EX)
03-The Fundamentals - Algorithms - Integers (EX)
03-The Fundamentals - Algorithms - Integers (EX)
The Fundamentals:
Algorithms The Integers
3.1- Algorithms
1.
3.1- Algorithms
2.
3.1- Algorithms
3.
3.2- The Growth of Functions
4. Determine whether each of these functions is O(x):
3.2- The Growth of Functions
5. Determine whether each of these functions is O x :
2
3.2- The Growth of Functions
6. Find the least integer n such that f(x) is
functions:
for n
O x of these
each
3.2- The Growth of Functions
7. Find the least integer n such that f(x) is
functions:
for
n
O x of these
each
1 log x x x log x x 2 2 x x !
O x4 n 4
O x n5
5
O x0 n 0
O x n 1
1
x 3 5log x x 3 5 x 3 6 x 3 6
x4 1
x4
x4
x
6 x
1
3.2- The Growth of Functions
8. Determine whether x 3 is O g x for each of these
functions g x .
a) g x x 2
b) g x x 3
c) g x x x
2 3
d ) gx x x 2 4
e) g x 3 x f ) g x x3 / 2
3.2- The Growth of Functions
9. Give a big-O estimate for each of these functions. For the
function g in your estimate that f (x) is O(g(x)), use a simple
function g of the smallest order.
3.2- The Growth of Functions
10. Give a big-O estimate for each of these functions. For
the function g in your estimate that f (x) is O(g(x)), use a
simple function g of the smallest order.
3.4- The Integers and Division
11. What are the quotient and remainder when
a) 19 is divided by 7? b) −111 is divided by 11?
c ) 3 is divided by 5? d) −1 is divided by 3?
3.4- The Integers and Division
12. Find a div m and a mod m when
a) a = 228, m = 119. c) a = −10101, m = 333.
b) a = 9009, m = 223. d) a = −765432, m = 38271.
3.4- The Integers and Division
13. Decide whether each of these integers is congruent to
5 modulo 17.
a) 80 b) 103 c) −29 d) −122
3.4- The Integers and Division
14. Find the integer a such that
a) a ≡ −15 (mod 27) and −26 ≤ a ≤ 0.
b) a ≡ 24 (mod 31) and −15 ≤ a ≤ 15.
c) a ≡ 99 (mod 41) and 100 ≤ a ≤ 140.
3.4- The Integers and Division
15. Find each of these values.
a) (−133 mod 23 + 261 mod 23) mod 23
b) (457 mod 23 · 182 mod 23) mod 23
3.5- Primes and Greatest
Common Divisors
3.5 Primes and Greatest Common Divisors
16. Find the prime factorization of each of these integers.
a) 126 b) 1001 c) 10!
3.5 Primes and Greatest Common Divisors
17. Determine whether the integers in each of these sets are
pairwise relatively prime.
a) 11, 15, 19
b) 14, 15, 21
d) 7, 8, 9, 11
3.5 Primes and Greatest Common Divisors