0% found this document useful (0 votes)
10 views65 pages

Week 13 Modular Arithmetic Check CodesDigits

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views65 pages

Week 13 Modular Arithmetic Check CodesDigits

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 65

WEEK 13

MODULAR
ARITHMETIC
• Congruence
• Least Residue
IsModular
a system of
Arithmetic
arithmetic for
integers, which
considers the
remainder.
Congruence of Modular
“a IS CONGUENT
Arithmetic

TO b MODULO m”
a ≡ b (mod m)
If a-b or b-a is divisible
by m.
Verify if the following
congruence are true.
a.) 3 ≡ 9
(mod 2)
It is true since 3 – 9 =
-6, which is divisible
by 2.
Verify if the following
congruence are true.
b.) 4 ≡ 15 (mod 3)
It is false since 4 – 15
= -11, which is not
divisible by 3.
Verify if the following
congruence are true.
c.) 7 ≡ 15 (mod 4)
It is true since 7 – 15
= -8, which is
divisible by 4.
Verify if the following
congruence are true.
d.) 5 ≡ 20 (mod 3)
It is true since 5 – 20
= -15, which is
divisible by 3.
Verify if the following
congruence are true.
e.) 4 ≡ 20 (mod 3)
It is false since 4 – 20
= -16, which is not
divisible by 3.
Modular Arithmetic:
Least Residue
To determine the least
residue is to simply get
the remainder when b is
divided by
r = b (mod m.
Modular Arithmetic:
Least Residue
r = b (mod
b(mod m)
m) means b
divided by m.
m is referred to as the
least residue
“r” x4
a.) r = 27(mod 6)
6 27
solve via
long -÷24
___
division: r=
3 3
least residue
“r” x9
3 29
b.) r = 29 (mod 3)
solve via
long -÷27
__
division: r=
2 2
least residue
“r” x8
4 35
c.) r = 35 (mod 4)
solve via
long -÷32
__
division: r=
3 3
least residue
“r” x5
9 50
d.) r = 50 (mod 9)
solve via
long -÷45
__
division: r=
5 5
least residue
“r” x3
8 30
e.) r = 30 (mod 8)
solve via
long -÷24
__
division: r=
6 6
least residue
“r” x5
5 25
f.) r = 25 (mod 5)
solve via
long -÷25
__
division: r=
0 0
least residue
“r” x1
56
g.) r = (10 - 4)(mod 5)
r = (6)(mod 5)
solve via
-÷5
__
long
division: r= 1
least residue
“r” x6
3 18
h.) r = (11 + 7)(mod 3)
r = (18)(mod 3)
solve via
-÷18
__
long
division: r= 0
least residue
“r” x 11
i.) r = ()(mod 7)
7 81
r = (81)(mod 7)
solve via
-÷77
__
long
division: r= 4
least residue
“r” x1
j.) r = (mod 3)
35
r = (5)(mod 3) -÷3
__
solve via
long
division: r= 2
least residue
“r” x4
5 24
k.) r = (8 ● 3)(mod 5)
r = (24)(mod 5)
solve via
-÷20
__
long
division: r= 4
WEEK 13
MODULAR
ARITHMETIC
APPLICATION:
Check Codes &
Check Digits
Check Codes &
Check Digits
There are different
methods in producing
identification
numbers.
modular arithmetic to produce
the identification numbers:
1. Universal Product Code
2. European Article Number
3. United States Postal Services
4. International Standard Book
Number
5. Credit Cards
6. Bank Routing Number
1. Universal
is mainlyProduct Code (UPC)
used in products sold in
department stores and groceries.
It consists of barcodes with 12
digits where the last one is the
check digit.
2. European Article Number (EAN-
13) is a standard bar code
system used in global trade.
It uses 13-digit number
where the last digit is the check
digit.
is an agency
3. United responsible
States Postal for (USPS)
Services
providing postal services in the United
States.
It consists of 11 digits where the last
digit is the check digit.
4. International Standard Book Number
is used on books which is usually
(ISBN)
found at the last or front page of the
book.
ISBN can be ISBN-10 or ISBN-13
where they used 10 or 13 digits with the
last digit as the check digit.
5.is composed
Credit Cards of 16 digits where
the last digit is also the check
digit.
is a 9-digit number used to identify
6.the bank
Bank from which
Routing Numberthe cheque is
issued.
It is more of an error-detecting code
in order to verify if the cheque number
is correct.
FORMULAS:
FORMULAS:
Determine the check digit of the UPC:

?
7-48485-
10223-?
748485102
d1 d2 7-48485-10223-?
d10 d11
d3 d4 d5 d6 d7 d8 d9

2
3
2
3 3 3 3 3
3
4, 24,4,24, 5, 3, 0 , 6 , 2 , 9
1 ,21+4+24+4+24+5+3+
6+2+9
21+4+24+4+24+5+3
+6+2+9
102
𝒅𝟏𝟐 =𝟏𝟎 − ( 𝟏𝟎𝟐 ) ( 𝒎𝒐𝒅 𝟏𝟎 )
𝒅𝟏𝟐 =𝟏𝟎 − 𝟐
𝒅𝟏𝟐 =𝟖?
Determine the check digit of the UPC:

?
0-92617-
96410-?
0
d
d
19
d
10
2
d 6
2
11
d 1
d
3 d7 d9 d6 d
d 0-92617-96410-?
4 5 6 7 8 9

410
3 3 3 3
3 3
, 6 , 6, 3 , 7, 27, 6 , 12, 1,0
0 , 99+6+6+3+7+27+6+1
+1
+6+6+3+7+27+6+
12+1 =77
𝒅𝟏𝟐 =𝟏𝟎 − ( 𝟕𝟕 ) ( 𝒎𝒐𝒅 𝟏𝟎 )
𝒅𝟏𝟐 =𝟏𝟎 − 𝟕
𝒅𝟏𝟐 =𝟑
?
Determine the check digit of the EAN-
13:

9-310779- ?
30000-?
93 1 0 d7
d1 d 2 d 3 d 4
d11 d12
7d79d83d90 d0
9-310779-30000-?
5 d6 10

00
3 3 3 3
3 3
9 , 9, 1, 0 , 7, 21, 9, 9, 0 , 0 , 0 , 0
9+9+1+7+21+9+9
9+9+1+7+21+9+9
65
𝒅𝟏 𝟑=𝟏𝟎 − ( 𝟔𝟓 ) ( 𝒎𝒐𝒅 𝟏𝟎 )
𝒅𝟏 𝟑 =𝟏𝟎 − 𝟓
𝒅𝟏 𝟑 =𝟓
?
Determine the check digit for the
USPS:

?
0254375059
?

-?
+5+4+3+7+5+5+
0254375059-?
9 =40
𝟏𝟏 =𝟗 − ( 𝟒𝟎 ) ( 𝒎𝒐𝒅 𝟗 )
4 NOT LEGIT!!!
5
?
Determine the check digit for the
ISBN:

978-621-406-
014-?
?
978 621406
978-621-406-014-?
d1 d 2 d 3 d 4
d10 d11 d12
d 5 d6 d7 d8 d9

014
3 3 3 3 3
2 3
9,19+21+8+18+2+3+4
, 8, 18, 2, 3, 4, 0 , 6, 0 , 1, 12
+6+1+12
9+21+8+18+2+3+4
+6+1+12
84
𝒅𝟏 𝟑=𝟏𝟎 − ( 𝟖𝟒 ) ( 𝒎𝒐𝒅 𝟏𝟎 )
𝒅𝟏 𝟑 =𝟏𝟎 − 𝟒
𝒅𝟏 𝟑 =𝟔
?
Determine the check digit for the
ISBN:
0-345-
43524-?
?
0-345-
0
d1
d8
3d2 43524-?
d9
4d3 5d4 4 3 5
d5 d6 d7

2 4
10 9 8 7 6 5 4
3 22
0 ,727+32+35+24+15+2
, 32, 35, 24, 15, 20 , 6 , 8
0+6+8
27+32+35+24+15+2
0+6+8
167
𝒅𝟏 𝟎=𝟏𝟏 − ( 𝟏𝟔𝟕 )( 𝒎𝒐𝒅 𝟏 𝟏 )
𝒅𝟏 𝟎 =𝟏𝟏 − 𝟐 ?

𝒅𝟏 𝟎 =𝟗
Determine the check digit of the Credit
Card:

5457-6238-
9823-411?
5457-6238-
5
d 1 4
d 2
9823-411?
5
d 3 7
d 4 d65 2
d 6 d37 d 8
8 d99 d 8
10 d 2
11
d12 d d d
13 14 15

3
2 4 1
2 1 2 2 2 2
12 2 ,
0 ,4 ,10,712 ,2,6 ,8 ,18,8 ,4 ,3 ,8,1 ,2
1, ,1, ,1, ,1 ,
0 ,4 0 ,72 ,2,6 ,88 ,8 ,4 ,3 ,8,1 ,2
1 ,
0 ,4 ,10,712 ,2,6 ,8 ,18,8 ,4 ,3 ,8,1 ,2
1, ,1, ,1, ,1 ,
01+4+1+7+1+2+2+6
,4 0 ,72 ,2,6 ,8 8 ,8 ,4 ,3 ,8,1 ,2
+8+1+8+8+4+3+8+
1+2
1+4+1+7+1+2+2+6+8+1+
8+8+4+3+8+1+2 =67
𝒅𝟏 𝟔=𝟏𝟎 − ( 𝟔𝟕 ) ( 𝒎𝒐𝒅 𝟏 𝟎 )
𝒅𝟏 𝟔 =𝟏𝟎 − 𝟕
𝒅𝟏 𝟔 =𝟑
?
Determine the check digit of the Credit
Card:

5288-5678-9012-
345?
5288-5678-9012-
5
d 1 2
d 2
345?
8
d 3 8
d 4 5
d 5 6
d 6 d77 d88 d99 d 0
10 d
11
1d 1
d d d
13 14 15

2
2 3 4
2 52 2 2 2
1
2 2
0 ,2 ,16,8 ,10,6,14,8 ,18,0 ,2 ,2 ,6 ,4 ,10
1, ,1, ,1, ,1, ,1 , ,1,
0 ,2 6 ,80 ,64 ,8 8 ,0 ,2,2 ,6,40
1
0 ,2 ,16,8 ,10,6,14,8 ,18,0 ,2 ,2 ,6 ,4 ,10
1, ,1, ,1, ,1, ,1 , ,1,
1+2+1+6+8+1+6
0 ,2 6 ,80 ,64 ,8 8 ,0 ,2,2 ,6,40

+1+4+8+1+8+2
+2+6+4+1
1+2+1+6+8+1+6+1+4+8+
1+8+2+2+6+4+1 =62
𝒅𝟏 𝟔=𝟏𝟎 − ( 𝟔𝟐 ) ( 𝒎𝒐𝒅 𝟏 𝟎 )
𝒅𝟏 𝟔 =𝟏𝟎 − 𝟐
𝒅𝟏 𝟔 =𝟖
?
Determine if the bank routing
number is valid or not.

04407232
4
04407232
0 4
d1
d8
d2
d9
4
4d3 0
d4 7d5 2d6 3
d7

2 , 4,
7 3 9 7
, , ,
3 9 7
3 9 ,
12+36+21+18+2
0 12 36 , 0 21 18 21 , 636
1+6+36
12+36+21+18+2=15
1+6+36 0
=( 𝟏𝟓𝟎 ) ( 𝒎𝒐𝒅 𝟏 𝟎 )
𝒓 =𝟎
Since r=0, the bank routing
number of the given cheque
is VALID.
Determine if the bank routing
number is valid or not.

01160111
0
01160111
0 1
d1
d8
d2
d9
0d31 d46 d50 1
d6 d7

1 1 0
7 3 9 7 3 9 7
3 9
0 , 3 ,9 ,42 ,0 ,9 ,7 ,3 ,0
3+9+42+9+7+3
3+9+42+9+7
=7
+3 3
𝒓 = ( 𝟕𝟑 ) ( 𝒎𝒐𝒅 𝟏 𝟎
𝒓 =𝟑
Since r=3, the bank routing
number of the given cheque
is NOT VALID.

You might also like