150 likes | 164 Views
Explore the fundamental concepts of integers, division, prime and composite numbers, greatest common divisor, least common multiple, modular arithmetic, congruence theorems, base b expansions, addition and multiplication of integers, and the Euclidean algorithm.
E N D
CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston mgasto1@cs.umbc.edu http://www.csee.umbc.edu/~mgasto1/203
Integers Ch. 2.4-2.5
Division Let a and b be integers with a 0. Then adividesb if there is an integer c such that b = ac. When a divides b, a is called a factor of b and b is called a multiple of a. The notation a | b denotes a divides b.
Primes A positive integer p> 1 is called primeif the only positive factors of p are 1 and p. A positive integer that is greater than 1 and is not prime is called composite.
The Fundamental Theorem of Arithmetic Theorem: Every positive integer greater than 1 can be written uniquely as a prime or as the product of two or more primes where the prime factors are written in order of nondecreasing size.
The Division Algorithm Theorem: Let a be an integer and d a positive integer. Then there are unique integers q and r, with 0 rd, such that a = dq + r. In the equality given in the above theorem, a is called the dividend,d is called the divisor, q is called the quotient,and r is called the remainder. This notation is used to express the quotient and remainder: q = a div dr = amod d.
Greatest Common Divisor Let a and b be integers, but not both 0. The largest integer d such that d | a and d | b is called the greatest common divisor of a and b. [ gcd(a,b) ]
Least Common Multiple Let a and b be positive integers. The largest integer d such that a | d and b | d is called the least common multiple of a and b. [ lcm(a,b) ]
Modular Arithmetic If a and b are integers and m is a positive integer, then a is congruent to b modulo m if m | (a – b). [ a b (modm) ]
Congruence Theorems Theorem: Let m be a positive integer. Then a b (mod m) if and only if amod m = bmod m. Theorem: Let m be a positive integer. Then a b (mod m) if and only if there is an integer k such that a = b + km. Theorem: Let m be a positive integer. If a b (mod m) and c d (mod m), then a + c b + d (mod m) and ac bd (mod m).
Base b Expansions Theorem: Let b be a positive integer greater than 1. Then if n is a positive integer, it can be expressed uniquely in the form n = akbk + ak-1bk-1 + . . . + a1b + a0, where k is a nonnegative integer, a0 , a1 , . . . , ak are Nonnegative integers less than b.
Constructing Base b Expansions procedurebase b expansion (n:positive integer) q := n k := 0 while (q 0) begin ak := q modb q := q / b k := k + 1 end {the base b expansion of n is (ak-1 ak-2 . . . a1 a0 )b }
Addition of Integers procedureadd (a,b:positive integers) c := 0 for j := 0 to n - 1 begin d := (aj + bj + c) / 2 sj := aj + bj + c - 2d c := d end sj := c {the binary expansion of the sumis (sn sn-1 . . . s0 )2 }
Multiplying Integers proceduremultiply (a,b:positive integers) c := 0 for j := 0 to n - 1 begin if bj then cj := a shifted j places else cj := 0 end p:= 0 for j := 0 to n – 1 p:=p + cj {p is the value of ab}
Euclidean Algorithm Lemma: Let a = bq + r, where a, b, q, and r are integers. Then gcd(a, b) = gcd(b, r) procedureprocedure (a,b:positive integers) x := a y := b while y 0 begin r := x mod y x := y y := r end {gcd(a, b) is x}