Check digits

26
Identification Numbers Check Digits, Zip Codes, Bar Codes

description

Discrete Math - Check Digits PPT, Mr. Sumerton

Transcript of Check digits

Page 1: Check digits

Identification Numbers

Check Digits, Zip Codes, Bar Codes

Page 2: Check digits

What are Identification Numbers?

• Codes used to identify a particular item.• Examples….?

Why use them?•Attempt to stop counterfeiting.•Error Correction.

Check Digit: The error correcting number in an identification number.

Page 3: Check digits

Check Digits

U.S. Postal Service money orders: 11 digit number

The 11th digit is the remainder when the sum of the first 10 digits is divided by 9.

Example: A money order with ID #: 1123456789 would have a check digit of …?

WORK…1+1+2+3+4+5+6+7+8+9 = 46/9 ---> remainder = 1The Check Digit would be 1Final ID Number: 11234567891

Page 4: Check digits

Try This… NOW!!!

A cashier incorrectly enters 63054383845 into the register – would the computer accept the card?

What Errors would the check digit not catch? Try 63924383845… What was changed? Why did it go through?

Is the ID # of this money order valid?

Try it…

Page 5: Check digits

American Express T.C.

Pattern: The check digit is the number that makes the sum divisible by 9.

Example: 387505055 – check digit 7

387505055/9 = 43056117.22222…. Hmmm? Easier way?

43056117*9 = 387505053 387505055 - 387505053 = 2

Adding 7 would make it divisible by 9.

Page 6: Check digits

Airline Tickets Pattern: Divide entire number by 7, the

remainder should be the check digit… There are 2 ID #’s

3026164775 – check digit 4 127881879532 – check digit 1

Is this a valid Airline Ticket?

This method is used on UPS and FedEx Packages, airline tickets, and rental cars.

Page 7: Check digits

Euro Bills… A Euro with ID # X1183806538 and check digit 4.

X is a country letter – in this case it converts to a 7. Is the bill valid?

Pattern: Check Digit makes sum divisible by 9.

What are the country codes on the following bills….?

(Cue: OVERHEAD)

Page 8: Check digits

Universal Product Codes (UPC)

• A far more complex pattern – for the check digit.

• Detects all single position errors and about 89% of other errors.

• For any UPC code: a1a2a3a4a5a6a7a8a9a10a11a12

• The computer is programmed to do the following:• 3a1+a2+3a3+a4+3a5+a6+3a7+a8+3a9+a10+3a11+a12

Page 9: Check digits

Corn Flakes?

• UPC: 058000001277• 3a1+a2+3a3+a4+3a5+a6+3a7+a8+3a9+a10+3a11+a12

• 3*0+5+3*8+0+3*0+0+3*0+0+3*1+2+3*7+7 = • 62

• Because 62 doesn’t end with a zero, the error is detected.

• If the error was in the second digit (5), what should the digit have been?

Page 10: Check digits

Grab A Box

• Check the UPC code

• 3a1+a2+3a3+a4+3a5+a6+3a7+a8+3a9+a10+3a11+a12

• Is the check digit correct?

• Show your work in notes…

Page 11: Check digits

Bank Account NumbersBank Account Numbers

Format: aFormat: a11aa22aa33aa44aa55aa66aa77aa88aa9 9 (a(a99 is the check digit) is the check digit)

Pattern: Pattern: 77aa11++33aa22++99aa33++77aa44++33aa55++99aa66++77aa77++33aa88

The check digit is the number in the ones place.The check digit is the number in the ones place.

The numbers The numbers 7,3,97,3,9 are called weights are called weights

TRY: TRY: 7342567473425674 – what is the correct check digit? – what is the correct check digit?

Page 12: Check digits

Codabar

Codabar – is one of the most efficient error detecting methods. Used at blood banks, libraries, German

banks, and some driver’s licenses.

Codabar consists of a 15 digit numbers 98% efficient

Page 13: Check digits

Codabar Pattern:

Add the digits in places 1,3,5,7,9,11,13,15 Multiply by 2. Next – count the number of digits that exceed 4 in places

1,3,5,7,9,11,13,15 and add it to your number. Finally add the remaining digits. (2,4,6,8,10,12,14) The check digit is what is needed to make your answer end in a zero.

EXAMPLE: 312560019643001(3+2+6+0+9+4+0+1)*2 = 50

6 and 9 exceed 4… Add 2 (50+2=52)

Now add the remaining digits52+1+5+0+1+6+3+0 = 68

The check digit is 2 ---> 68+2 = 70

Page 14: Check digits

Codabar Credit Card

• Run a check on this Credit Card: Add the digits in places 1,3,5,7,9,11,13,15 Multiply by 2. Next – count the number of digits that exceed 4 in places 1,3,5,7,9,11,13,15 and add it to your number. Finally add the remaining digits. (2,4,6,8,10,12,14) The check digit is what is needed to make your answer end in a zero.

Call the COPS!

Page 15: Check digits

ISBN Numbers• 100% error proof!• 10 Digit number:

– a1a2a3a4a5a6a7a8a9a10

• Pattern:

• 10a1+9a2+8a3+7a4+6a5+5a6+4a7+3a8+2a9+1a10

• Check: Evenly divisible by 11.

Page 16: Check digits

Test the ISBN to the Discrete Book

Example FAPP:• 0-7167-4782-0 Hard Bound• 0-7167-4783-9 Paperback• 10*0+9*7+8*1+7*6+6*7+5*4+4*7+3*8+2*2+1*0 =

231

• Since 231/11 = 21, no error.

• Transpose any 2 numbers is an error found?(work on board)

Page 17: Check digits

Personal Identification Numbers

Page 18: Check digits

V.I.N.Vehicle Identification Number…

Page 19: Check digits

ZIP CODES

Page 20: Check digits

Bar Codes

Page 21: Check digits

Bar Codes

Page 22: Check digits

Social Security

The first three numbers… what is yours?

Page 23: Check digits

Soundex Coding System• Used to convert sounds to numbers.• The first 4 Digits of some Drivers Licenses are Soundex Codes.• PATTERN:

1. Delete all occurrences of H and W, (ex Schworer becomes Scorer)

2. Assign numbers to the following letters as follows:a,e,i,o,u,y -----> 0 d,t -------> 3 r ----------> 6b,f,p,v, ----------> 1 L ---------> 4 c,g,j,k,q,s,x,z --> 2 m,n ------> 5

3. If two or more letters with the same value are next to each other drop all but the first. (Example: Scorer becomes Sorer)4. Delete the first character of the original name if it is still there. (example: Scorer becomes corer)5. Delete all occurrences of a,e,i,o,u, and y.6. Retain only the first three digits of the remaining letters and put the starting letter

(as a letter) first. If only 2 digits remain add zeros to the end.

EXAMPLE: Step1 Step2 Step3 Step4 Step5Step6Schworer Scorer Scorer Sorer orer rr

S-660 (drop h,w) 220606 20606 0606 66Try your name…

Page 24: Check digits

Drivers Licenses…

Moss = moss --> moss --> mos --> os --> s --> 200

5022 502 02 2

Page 25: Check digits

Convert this to Soundex…

Dolemite --> Dolemite --> olemite --> lmt ----> D-453 30405030 0405030 453

Page 26: Check digits

Check Digit Knowledge

BEFORE

AFTER