Uploaded by Cha Cha

WEEK 13

advertisement
APPLICATIONS OF
MODULAR ARITHMETIC
By: Remelyn L. Asahid
AMACC DAVAO
OBJECTIVES
1.Apply
modular arithmetic in determining
ISBN check digit and UPC.
2.Determine a valid card number using
modular arithmetic.
3.Encode messages using modular arithmetic.
By: Remelyn L. Asahid
AMACC DAVAO
What The ISBN Check Digit Is For
The check digit in an ISBN number is there to help prevent errors in transmission.
When an ISBN number is read and entered into any system that is used to deal with
ISBNs, such as a book cataloguing system, whether the ISBN is entered by hand or by
means of a bar code scanner, the check digit as read from the entered number is
compared to a check digit calculated from the remainder of the ISBN that has been
entered. If the two check digits are the same, then there is a good chance that the
complete ISBN, all of its digits, has been read correctly.
As an example, if I enter the ISBN 9781861972712 into a system that uses ISBNs, it
will take the first twelve digits (978186197271) of the ISBN and calculate the check
digit for that series of twelve digits. It will come up with the number 2 as the correct
digit and compare it to the number that I entered earlier, and find that I entered the
number 2 as well. In that case, the chances are I entered the digits correctly. However,
supposing I entered the ISBN incorrectly and made a mistake by transposing the fifth
and sixth digits, entering the ISBN as 9781681972712. When the system calculate the
check digit for 978168197271 it will come up with 8 as the check digit for that number.
It will compare 8 with 2 and know that a mistake of some sort has been made. It won't
know where the error is, only that something is wrong.
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
How The ISBN Check Digit Is Calculated
This is the process:
1. Take the first 12 digits of the 13-digit ISBN
2. Multiply each number in turn, from left to right by a number. The first
digit is multiplied by 1, the second by 3, the third by 1 again, the fourth
by 3 again, and so on to the eleventh which is multiplied by 1 and the
twelfth by 3.
3. Add all of the 12 answers.
4. Do a modulo 10 division on the result from step 2.
5. Take that remainder result from step 4.If it's a zero, then the check
digit is zero. If the remainders isn't zero then subtract the remainder
from 10. The answer to that is your check digit.
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
AMACC DAVAO
D12 = 10 – [(3*7) + 6 + (3*7) + 6 + (3*8) + 5 + (3*1) + 0 + (3*5) + 4 + (3*6) mod 10
= 10 – (21 + 6 + 21 + 6 + 24 + 5 + 3 + 0 + 15 + 4 + 18) mod 10
= 10 - 123 mod 10
= 10 – 3
=7
By: Remelyn L. Asahid
AMACC DAVAO
D12 = 10 – [(3*0) + 4 + (3*0) + 0 + (3*0) + 0 + (3*1) + 5 + (3*1) + 6 + (3*6) mod 10
= 10 – (0 + 4 + 0 + 0 + 0 + 0 + 3 + 5 + 3 + 6 + 18) mod 10
= 10 - 39 mod 10
= 10 – 9
=1
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
AMACC DAVAO
The Luhn algorithm or Luhn formula, also known as the "modulus
10" or "mod 10" algorithm, named after its creator, IBM scientist Hans
Peter Luhn, is a simple checksum formula used to validate a variety
of identification numbers, such as credit card numbers, IMEI
numbers, National Provider Identifier numbers in the United States,
Canadian Social Insurance Numbers, Israeli ID Numbers, South African
ID Numbers, Greek Social Security Numbers (ΑΜΚΑ), and survey
codes appearing on McDonald's, Taco Bell, and Tractor Supply Co.
receipts. It is described in U.S. Patent No. 2,950,048, filed on
January 6, 1954, and granted on August 23, 1960.
By: Remelyn L. Asahid
AMACC DAVAO
The formula verifies a number against its included check digit, which is
usually appended to a partial account number to generate the full account
number. This number must pass the following test:
From the rightmost digit (excluding the check digit) and moving left,
double the value of every second digit. The check digit is neither doubled nor
included in this calculation; the first digit doubled is the digit located
immediately left of the check digit. If the result of this doubling operation is
greater than 9 (e.g., 8 × 2 = 16), then add the digits of the result (e.g., 16: 1
+ 6 = 7, 18: 1 + 8 = 9) or, alternatively, the same final result can be found by
subtracting 9 from that result (e.g., 16: 16 − 9 = 7, 18: 18 − 9 = 9).
Take the sum of all the digits (including the check digit).
If the total modulo 10 is equal to 0 (if the total ends in zero) then the
number is valid according to the Luhn formula; otherwise it is not valid.
By: Remelyn L. Asahid
AMACC DAVAO
Example for computing check digit
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
AMACC DAVAO
By: Remelyn L. Asahid
AMACC DAVAO
Cryptography and Modular
Arithmetic
https://www.math.ust.hk/~yangwang/Co
urse/2016FSMath4999/Week%201/cryptoneu%20notes.pdf
That’s the end of
WEEK 13!
By: Remelyn L. Asahid
AMACC DAVAO
Download