Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston

Similar presentations


Presentation on theme: "CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston"— Presentation transcript:

1 CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston

2 Integers Ch

3 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 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 prime if 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 d r = a mod 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 (mod m) ]

10 Congruence Theorems Theorem: Let m be a positive integer. Then
a  b (mod m) if and only if a mod m = b mod 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 a1b + a0, where k is a nonnegative integer, a0 , a1 , , ak are Nonnegative integers less than b.

12 Constructing Base b Expansions
procedure base b expansion (n:positive integer) q := n k := 0 while (q  0) begin ak := q mod b q :=  q / b  k := k + 1 end {the base b expansion of n is (ak-1 ak a1 a0 )b }

13 Addition of Integers procedure add (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 sum is (sn sn s0 )2 }

14 Multiplying Integers procedure multiply (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) procedure procedure (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 }


Download ppt "CMSC 203, Section 0401 Discrete Structures Fall 2004 Matt Gaston"

Similar presentations


Ads by Google