Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

GROUP 3

Integers: Greatest Common Divisor & Euclidean Algorithm

What are Integers?

An integer is a number which can be positive or negative or zero. The types of numbers
could be any number such as natural numbers, whole numbers, real number and rational
numbers.
Integers are numbers which cannot be decimals or fractions. They are either whole numbers or
negative numbers. Some examples are: 2, 7, 0, -9, -12, etc.

Rules of Integers
The rules of integers are defined by the operations performed on them. Such as:
 Adding of integers
 Subtracting of integers
 Multiplication of integers
 Division of integers
Adding integers
 If we add two positive integers, then the sign of the resultant integers remains the same.
Example: 5 + 7 = 12.
 If we add two negative integers, then the sign of the resultant integer will be negative.
Example: (-5)+(-7) = -5-7 = -12
 If we add one positive integer and one negative integer, then the sign of the result will
depend on the integer having greater value. Example: 5 + (-7) = -2

Subtracting Integers
 If we subtract two positive integers, then the sign of the resultant integer will depend on
the greater value. Example: 9 – 2 = 7
 If we subtract two negative integers, then the sign of the second integer is changed to
positive and the sign of output will be the sign of greater value. Example: (-5)-(-7) = -5+7
=2

Multiplication and Division Integers


If the sign of the integers is the same, then multiplication and division of these integers produce
positive value.

Example: (-5) x (-7) = 35 and 5 x 7 = 35


In case of division,
(-35)/(-5) = 7 & (35/5) = 7
If the signs are different, then the answer is always negative.
Example: (-5) x 7 = -35 & -35/5 = -7
Are negative numbers integers?
Negative numbers which are not fractions are all integers.
Or
All the numbers below value 0 and which are not fractions are also integers.
Examples: -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, …,-∞.
But numbers such as -½, -¾, -9.5, -10.5, etc. are not integers.

Is 0 an integer?
Yes, zero is an integer, apart from negative and positive real numbers. If we have to represent
the integers as a whole with 0, then it can be done as:
……….,-10, -9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10…

Whole numbers and Integers


If we compare whole numbers and integers, then we can understand that all the whole numbers
are integers but not all the integers are whole numbers. Since whole numbers start from value 0
and go till infinity, they do not consist of negative numbers. But, integers consist of negative
numbers too.

What is the greatest common divisor?


The greatest common divisor (GCD) of two or more numbers is the greatest common
factor number that divides them, exactly. It is also called the highest common factor (HCF). For
example, the greatest common factor of 15 and 10 is 5, since both the numbers can be divided
by 5.
15/5 = 3
10/5 = 2

If a and b are two numbers then the greatest common divisor of both numbers is denoted by gcd
(a, b). To find the gcd of numbers, we need to list all the factors of the numbers and find the
largest common factor.
Suppose, 4, 8, and 16 are three numbers. Then the factors of 4, 8 and 16 are:

4 → 1, 2, 4
8 → 1, 2, 4, 8
16 → 1, 2, 4, 8, 16
Therefore, we can conclude that 4 is the highest common factor among all three numbers.

How to find the greatest common divisor


Before we move ahead to find the greatest common divisor of numbers, let us understand what
a divisor and a common divisor are.
What is the Divisor?
The Divisor of a number divides the original number evenly. For example, if 8 is the divisor of
64, then 8 can divide 64 into 8 equal parts.
What are Common Divisors?
If the divisor of a number is a divisor of another number, then it is said to be a common factor
for the two numbers. For example, 2 is a factor of 4 and 8, hence 2 is a common factor.

GCD
GCD is the greatest common factor of two or more numbers. A factor that is the highest among
the numbers.

Example 1 12 33
Divisors 1, 2, 3, 4, 6, 12 1, 3, 11, 33
Common Divisors 1, 3
Greatest Common Divisor
3
(GCD)

GCD (12, 33) = 3


Example 2 25 150
1, 2, 3, 5, 6, 10, 15, 25, 30,
Divisors 1, 5, 25
50, 75, 150
Common Divisors 1, 5, 25
Greatest Common Divisor
25
(GCD)

GCD (25, 150) = 25

Example 3 13 33
Divisors 1, 13 1, 33
Common Divisors 1
Greatest Common Divisor
1
(GCD)
GCD (13, 33) = 1

Methods to Find GCD


There are several methods to find the greatest common divisor of given two numbers.
 Prime factorization method
 Long division method
 Euclid’s division algorithm

Introducing the Euclidean Algorithm


The Euclidean algorithm calculates the greatest common divisor (GCD) of two natural
numbers a and b. The greatest common divisor is the largest natural number that divides both a
and b without leaving a remainder.
 Euclidean Algorithm or Euclid’s Algorithm.
 For computing the Greatest Common Divisor (GCD).

2
0 3
Euclid’s Algorithm for Finding GCD 12 33
24
Method 1
Ex. 1 Find the GCD (12, 33). 9

Q A B R
1 3
2 33 12 9 9 12 3 9
9 9 9
1 12 3
3 0
3 9 3 0

X 3 0 X

GCD (12, 33) = 3

1 5
Ex. 2 Find the GCD (750, 900). 750 900 150 750
750 750
Q A B R 150 0
1 900 750 150

5 750 150 0 0 150

X 150 0 X

GCD (750, 900) = 150


Euclid’s Algorithm for Finding GCD

Method 2
Prerequisite: a > b
Euclid_GCD (a, b):
If b = 0 then
return a;
else
return Euclid_GCD (b, a mod b);

Example 1: Find the GCD (50, 12).


Solution:
Here a = 50, b = 12
GCD (a, b) = GCD (b, a mod b)
GCD (50, 12) = GCD (12, 50 mod 12) = GCD (12, 2)
GCD (12, 2) = GCD (2, 12 mod 2) = GCD (2, 0) = 2
GCD (50, 12) =2

Example 2: Find the GCD (83, 19).


Solution:
Here a = 83, b = 19
GCD (a, b) = GCD (b, a mod b)
GCD (83, 19) = GCD (19, 83 mod 19) = GCD (19, 7)
GCD (19, 7) = GCD (7, 19 mod 7) = GCD (7, 5)
GCD (7, 5) = GCD (5, 7 mod 5) = GCD (5, 2)
GCD (5, 2) = GCD (2, 5 mod 2) = GCD (2, 1)
GCD (2, 1) = GCD (1, 2 mod 1) = GCD (1, 0) = 1
GCD (83, 19) =1

You might also like