The document summarizes key concepts from a lecture on division algorithms:
1. The Division Algorithm states that for any integer a and positive integer b, there exist unique integers q and r such that a = bq + r, where 0 ≤ r < b. q is the quotient and r is the remainder.
2. The div and mod operators can be used to find the quotient and remainder of a division, such as 13 div 5 = 2 and 13 mod 5 = 3.
3. A number b is said to divide a (written b|a) if the remainder is 0 when applying the Division Algorithm to a and b.
The document summarizes key concepts from a lecture on division algorithms:
1. The Division Algorithm states that for any integer a and positive integer b, there exist unique integers q and r such that a = bq + r, where 0 ≤ r < b. q is the quotient and r is the remainder.
2. The div and mod operators can be used to find the quotient and remainder of a division, such as 13 div 5 = 2 and 13 mod 5 = 3.
3. A number b is said to divide a (written b|a) if the remainder is 0 when applying the Division Algorithm to a and b.
The document summarizes key concepts from a lecture on division algorithms:
1. The Division Algorithm states that for any integer a and positive integer b, there exist unique integers q and r such that a = bq + r, where 0 ≤ r < b. q is the quotient and r is the remainder.
2. The div and mod operators can be used to find the quotient and remainder of a division, such as 13 div 5 = 2 and 13 mod 5 = 3.
3. A number b is said to divide a (written b|a) if the remainder is 0 when applying the Division Algorithm to a and b.
LECTURE 3 9-8-2019 BITS Pilani Michael Alphonse Hyderabad Campus The topic to be covered
1. Division Algorithm 2. Div and mod operators 3. Divisibility Relation
BITS Pilani, Hyderabad Campus
The Division Algorithm
Let a be any integer and b a positive integer. Then there
exist unique integers q and r such that a = bq + r Where 0≤r<b. a is called dividend, b divisor, q quotient and r remainder. Proof : Consider the set S = {a-bn: n∈Z and a-bn≥0}. We will use well-ordering principle on S to prove this theorem. In order to use well-ordering principle we must prove that’s is non-empty. By well – ordering principle, S will have least element r. This r will play the role of remainder. Details of the proof will be done in class.
BITS Pilani, Hyderabad Campus
BITS Pilani, Hyderabad Campus Examples
Find the quotient r and remainder r ?
(i) When 338 is divided by 21. 338 = 21 * 16 + 2 quotient = 16 and remainder 2.
(ii) When -338 is divisible by 21.
-338= 21*(-16) + (-2) -338 = 21*(-17)+ 19 Quotient = 16 or 17 ? Remainder = -2 or 19 ? Which one is correct ?
BITS Pilani, Hyderabad Campus
Division and Mod operator
The binary operators, div and mod are defined as follows :
a div b = quotient when a divided by b A mod b = remainder when a is divided by b. 13 div 5 = 2 13 mod 5 = 3 -23 div 5 = -5 and -23 mod 5 = 2
Divisibility Relation : Let a be any integer and b a positive
integer. If the remainder r = 0 when we apply division algorithm the we say that b divides a or a is divisible by b. When b divides a we write b|a.