Integers and Divisibility
Integers and Divisibility
DIVISIBILITY
NUMBER THEORY is a branch of
mathematics that explores integers and their
INTEGERS
properties.
INTEGERS:
• Z integers {…, -2,-1, 0, 1, 2, …}
• Z+ positive integers {1, 2, …
INTEGERS
a.b Z a.b=b.a
Associative Laws: a+(b+c)=(a+b)+c
a.(b.c)=(a.b).c
Identity Elements: a+0=0+a=a 0-additive identity
a.1=1.a=a 1-multiplicative identity
INTEGERS
Fundamental theorem of Arithmetic: • Any positive integer
greater than 1 can be expressed as a product of prime numbers.
Examples:
• 12 = 2*2*3
• 21 = 3*
DIVISION
equal 0). We say that a divides b if there is an integer c such that
b = ac. If a divides b we say that a is a factor of b and that b
is multiple of a.
The fact that a divides b is denoted as a | b.
Examples:
• 4 | 24 True or False? True 4is a factor of 24 and 24 is a multiple of 4
PRIMES
is divisible only by 1 and by itself (p) is called a prime.
Examples:
2, 3, 5, 7, …
1 | 2 and 2 | 2, 1 |3 and 3 | 3, etc
Primes and Composites
How to determine whether the number is a prime or a composite
PRIMES
Let n be a number. Then in order to determine whether it is a prime we can
test:
• Approach 1: if any number x < n divides it. If yes it is a composite. If we
test all numbers x < n and do not find the proper divisor then n is a prime.
• Approach 2: if any prime number x < n divides it. If yes it is a composite. If
we test all primes x < n and do not find a proper divisor then n is a prime.
• Approach 3: if any prime number x < 𝑛 divides it. If yes it is a composite.
If we test all primes x < 𝑛 and do not find a proper divisor then n is a prime.
Division
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.
DIVISION
Definitions:
• a is called the dividend,
• d is called the divisor,
• q is called the quotient and
• r the remainder of the division.
Relations:
• q = a div d , r = a mod d
GREATEST COMMON DIVISOR
GCD
p2 min(a2,b2) p3 min(a3,b3) … pk min(ak,bk)
Examples:
• gcd(24,36) = ?
• 24 = 2*2*2*3=23*3
• 36= 2*2*3*3=22*32
• gcd(24,36) =
LEAST COMMON MULTIPLE
Definition: Let a and b are two positive integers. The least common multiple of
a and b is the smallest positive integer that is divisible by both a and b.
LCM
The least common multiple is denoted as lcm(a,b).
Example:
• What is lcm(12,9) =?
• Give me a common multiple: …
12*9= 108
• Can we find a smaller number?
Yes. Try 36. Both 12 and 9 cleanly divide 36.
LEAST COMMON MULTIPLE
LCM
Example:
• What is lcm(12,9) =?
• 12 = 2*2*3=22*3
• 9=3*3 =32
• lcm(12,9)= 22 * 32 = 4 * 9 = 36
• Factorization can be cumbersome and time consuming since we need to find
all factors of the two integers that can be very large.
ALGORITHM
• Luckily a more efficient method for computing the gcd exists: • It is called
EUCLID
Euclid’s algorithm – the method is known from ancient times and
named after Greek mathematician Euclid.
Eucledian Algorithm for finding the GCD
ALGORITHM
EUCLID
Eucledian Algorithm for finding the GCD
ALGORITHM
EUCLID
Example
ALGORITHM
• Find the GCD of the integers 448 and 196.
EUCLID
• Find the GCD of the integers 675 and 1080.
EUCLID
ALGORITHM
EUCLID
ALGORITHM