Lecture 12. The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the...

12
Modular Arithmetic Lecture 12

Transcript of Lecture 12. The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the...

Page 1: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

Modular ArithmeticLecture 12

Page 2: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check digit (the 10th digit) is multiplied by 1. The sum of these should be evenly divisible by 11.

The ISBN 13-digit uses a different system: add all the digits in the odd places values; add all the digits in the even place values and multiply this sum by 3; finally add the two results. This result should be evenly divisible by 10.

International Standard Book Number (ISBN)

Page 3: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

A certain textbook has ISBN 1-285-56352-C, where C is the check digit. Let’s determine what that number should be.

First we multiply appropriately:

ISBN-10 Example

10(1) 9 2 8 8 7 5 6 5 5 6 4 3 3 5 2 2 1

10 18 64 35 30 30 12 15 4

218

C

C

C

Page 4: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

We now need 218 + C to be divisible by 11. Multiples of 11 (near where we care) are 198, 209, and 220.

If we add 218 + 2 we will get an even multiple of 11, namely 220. Therefore C = 2

Page 5: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

Using the 10-digit ISBN 1-285-56352-2 from our previous example, we will now convert it to a 13-digit ISBN.

First, attach 978 to the front of the number and remove the original check digit in order to get 978-1-285-56352-C, where C is the new check digit.

Next, add all the digits in the odd place values: 9+8+2+5+6+5+C = 35 + C.

Then add all the digits in the even place values and multiply the result by 3: 3(7+1+8+5+3+2) = 3(26) = 78.

Add these to get 35 + C + 78 = 113 + C. We need this to be divisible by 10 so C = 7.

ISBN – 13 Example

Page 6: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

To find the check digit in a UPC code we multiply the digits in the odd place values by 3 and the digits in the even place values by 1. Add these results to a value that is divisible by 10.

Universal Product Code(UPC)

Page 7: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

Find the missing check digit in the product with UPC 0 44700 07205 C.

Multiply the digits in odd place values by 3 to get: 3(0+4+0+0+2+5) = 3(11) = 33.

Multiply the digits in the even place values by 1 to get: 1(4+7+0+7+0+C) = 18 + C.

Add these together to get 33 + 18 + C = 51 + C.

It must be that C = 9 so that the result is a multiple of 10.

UPC Example

Page 8: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

A correct bank routing number is determined by multiplying the digits of the routing number by 7, 3, 9, 7, 3, 9, 7, 3, 9, adding the results and the final sum must be divisible by 10.

Bank routing numbers do not have a traditional check digit, it is more of an error detecting code in order to verify the number given is correct.

Bank Routing Numbers

Page 9: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

I think my Wells Fargo routing number is 107002129. Let’s check:

7(1)+3(0)+9(7)+7(0)+3(0)+9(2)+7(1)+3(2)+9(9) = 7+63+18+7+6+81 = 182.

This number must be incorrect because 182 is not evenly divisible by 10.

In order to determine the correct error, probably due to a transposition, I will switch pairs of numbers until I find the correct code.

Bank Routing Example

Page 10: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

To determine the last digit of a 16-digit credit card number:◦ Add the digits in the odd place values and double

the result.◦ Next, count the number of digits in the odd place

values that are greater than 4 and add this to the total.

◦ Finally, add the previous result to the sum of the digits in the even place values.

◦ The final sum must be divisible by 10.

Credit Card Check Digits(Codabar)

Page 11: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

A card is issued with the number 3125 6001 9643 001C, where C is the check digit. Let’s find it.

Add digits in the odd place values and double the result: 2(3+2+6+0+9+4+0+1) = 2(25) = 50.

Count the number of digits in odd place values that are more than 4: only 2 (the 6 and 9) so we add 2 + 50 to get 52.

Add the values in even place values to 52 to get: 52+1+5+0+1+6+3+0+C = 68 + C.

In order for this to be divisible by 10 C must be 2.

Credit Card Example

Page 12: Lecture 12.  The ISBN 10-digit uses a reverse weighting system: multiply the first digit by 10, the second by 9, the third by 8 and so on until the check.

Add the first 10 digits and divide by 9. The check digit is the remainder.

Example: A money order has number 6312472907C. Find the check digit. ◦ Add the first ten digits to get

6+3+1+2+4+7+2+9+0+7 = 41. ◦ Divide 41 by 9 to get 41 = 9(4) + 5, where 5 is

the remainder.◦ It must be that C = 5.

U.S. Postal Money Orders