1 / 15

CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston mgasto1@cs.umbc

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 a divides b if there is an integer c such that b = ac . When a divides

shiri
Download Presentation

CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston mgasto1@cs.umbc

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston mgasto1@cs.umbc.edu http://www.csee.umbc.edu/~mgasto1/203

  2. Integers Ch. 2.4-2.5

  3. 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.

  4. 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.

  5. 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.

  6. The Division Algorithm Theorem: Let a be an integer and d a positive integer. Then there are unique integers q and r, with 0 rd, 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.

  7. 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) ]

  8. 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) ]

  9. 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) ]

  10. 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).

  11. 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.

  12. 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 }

  13. 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 }

  14. 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}

  15. 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}

More Related