Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 16 in COMAP Book Jocelyn Westray. Objectives Understand what a check digit is. Systems dividing by 7 and 9. Systems with weights. Codabar method.

Similar presentations


Presentation on theme: "Chapter 16 in COMAP Book Jocelyn Westray. Objectives Understand what a check digit is. Systems dividing by 7 and 9. Systems with weights. Codabar method."— Presentation transcript:

1 Chapter 16 in COMAP Book Jocelyn Westray

2 Objectives Understand what a check digit is. Systems dividing by 7 and 9. Systems with weights. Codabar method Systems multiplying by 13 Applications such as UPC, ZIP codes, and Bar codes. Soundex Coding System Drivers License information

3 Introduction A code is a symbolic way to represent information

4 Introduction A code is a symbolic way to represent information A revolution in information management took place at a grocery store in Ohio in June, 1974, when a 10 pack of Wrigleys Juicy Fruit gum was the first bar-coded retail product purchased.

5 Introduction A code is a symbolic way to represent information A revolution in information management took place at a grocery store in Ohio in June, 1974, when a 10 pack of Wrigleys Juicy Fruit gum was the first bar-coded retail product purchased. All kinds of things have assigned identification numbers: money orders, airline tickets, bank checks, books, and cars

6 Check Digits A check digit is a number in an identification code used for error detection.

7 Check Digits A check digit is a number in an identification code used for error detection. This method is used in several different identification schemes.

8 Check Digits A check digit is a number in an identification code used for error detection. This method is used in several different identification schemes. Error detecting mechanisms have to be used in identification numbers in order to ensure that the appropriate item is being identified.

9 Division by 9 Schemes Example: Consider the U.S. Postal Service money order with the number 17620289526.

10 Division by 9 Schemes Example: Consider the U.S. Postal Service money order with the number 17620289526. The last digit, 6 (the 11 th digit) serves as an error detecting mechanism

11 Division by 9 Schemes Example: Consider the U.S. Postal Service money order with the number 17620289526. The last digit, 6 (the 11 th digit) serves as an error detecting mechanism This 11 th digit is the remainder obtained when the sum of the first 10 digits is divided by 9.

12 Division by 9 Schemes Example: Consider the U.S. Postal Service money order with the number 17620289526. The last digit, 6 (the 11 th digit) serves as an error detecting mechanism This 11 th digit is the remainder obtained when the sum of the first 10 digits is divided by 9. 1+7+6+2+0+2+8+9+5+2=42

13 Division by 9 Schemes Example: Consider the U.S. Postal Service money order with the number 17620289526. The last digit, 6 (the 11 th digit) serves as an error detecting mechanism This 11 th digit is the remainder obtained when the sum of the first 10 digits is divided by 9. 1+7+6+2+0+2+8+9+5+2=42 42 divided by 9 is 36, so the remainder is 6.

14 Division by 9 Schemes Suppose instead of the correct number, the number 1760289526 (an error in the 4 th positionsimply an incorrect number) was entered into the computer.

15 Division by 9 Schemes Suppose instead of the correct number, the number 1760289526 (an error in the 4 th positionsimply an incorrect number) was entered into the computer. The sum would be 44, and the remainder, 8. Therefore, the error would be detected.

16 Problems with Division by 9 This method will not detect the mistake of replacing a 0 with a 9, or vice versa. Because the value of a sum doesnt depend on the order in which the numbers are added, this method does not detect the transposition (switching) of digits.

17 Example American Express Travelers Cheques use a similar method where the check digit is the smallest nonnegative integer such that the sum of the digits, including the check digit, is evenly divisible by 9.

18 Example American Express Travelers Cheques use a similar method where the check digit is the smallest nonnegative integer such that the sum of the digits, including the check digit, is evenly divisible by 9. The American Express Travelers Cheque with the identification number 387505055 has what check digit?

19 Example American Express Travelers Cheques use a similar method where the check digit is the smallest nonnegative integer such that the sum of the digits, including the check digit, is evenly divisible by 9. The American Express Travelers Cheque with the identification number 387505055 has what check digit? It has the check digit 7 because 3+8+7+5+0+5+0+5+5=38 and 38+7 is evenly divisible by 9.

20 Division by 7 Schemes This is used on airline tickets and for Avis and National rental cars.

21 Division by 7 Schemes This is used on airline tickets and for Avis and National rental cars. It assigns the remainder after division by 7 of the number itself as the check digit rather than dividing the sum of the digits by 7.

22 Division by 7 Schemes This is used on airline tickets and for Avis and National rental cars. It assigns the remainder after division by 7 of the number itself as the check digit rather than dividing the sum of the digits by 7. Example:

23 Division by 7 Schemes This is used on airline tickets and for Avis and National rental cars. It assigns the remainder after division by 7 of the number itself as the check digit rather than dividing the sum of the digits by 7. Example: The check digit for the number 540047 is 4 because 540047=7 x 77149 + 4.

24 Division by 7 Schemes This is used on airline tickets and for Avis and National rental cars. It assigns the remainder after division by 7 of the number itself as the check digit rather than dividing the sum of the digits by 7. Example: The check digit for the number 540047 is 4 because 540047=7 x 77149 + 4. This method will not detect the substitution of 0 for a 7, 1 for an 8, or 2 for a 9, or vice versa.

25 Division by 7 Schemes Unlike division by 9 schemes, this will detect transpositions of adjacent digits with the exceptions of the aforementioned pairs.

26 Division by 7 Schemes Unlike division by 9 schemes, this will detect transpositions of adjacent digits with the exceptions of the aforementioned pairs. Example: If 5400474 were entered in as 4500474, the machine would determine that the appropriate check digit should be 3.

27 Division by 7 Schemes Unlike division by 9 schemes, this will detect transpositions of adjacent digits with the exceptions of the aforementioned pairs. Example: If 5400474 were entered in as 4500474, the machine would determine that the appropriate check digit should be 3. You can use Google to determine the check digits that require division by 7 or 9 by entering 540047 mod 7 (or mod 9).

28 Division by 7 Schemes You can also use a calculator to find the remainder. a/b=q Using the whole number portion of q: r=a-bq Consider 123 divided by 7, we get 17.57, then 123 – 7 x 17 = 4.

29 Universal Product Code (UPC) This is often used on grocery products. Consider the number 0 38000 00127 7 found on the bottom of a box of Kelloggs Corn Flakes. The first digit identifies a broad category of goods, the next 5 identify the manufacturer, the next 5 identify the product, and the last is a check digit.

30 Universal Product Code (UPC) For any UPC number a 1,a 2,a 3,a 4,a 5,a 6,a 7,a 8,a 9,a 10,a 11,a 12, the computer is programmed to carry out the following computation:

31 Universal Product Code (UPC) For any UPC number a 1,a 2,a 3,a 4,a 5,a 6,a 7,a 8,a 9,a 10,a 11,a 12, the computer is programmed to carry out the following computation: 3a 1 +a 2 +3a 3 +a 4 +3a 5 +a 6 +a 7 +a 8 +3a 9 +a 10 + 3a 11 +a 12

32 Universal Product Code (UPC) For any UPC number a 1,a 2,a 3,a 4,a 5,a 6,a 7,a 8,a 9,a 10,a 11,a 12, the computer is programmed to carry out the following computation: 3a 1 +a 2 +3a 3 +a 4 +3a 5 +a 6 +a 7 +a 8 +3a 9 +a 10 + 3a 11 +a 12 If the answer doesnt end in zero, the computer knows the entered number is incorrect.

33 Universal Product Code (UPC) Returning to the Kelloggs UPC, if we entered 0 58000 00127 0 (a 5 instead of a 3), the computer would find a sum of 62, which doesnt end in 0, so the error is detected. This simple scheme detects all single- position errors and about 89% of all other kinds of errors.

34 Universal Product Code (UPC) The 12 digit UPC used in the US paved the way for the 13 digit EAN used in Europe, which became the world-wide standard. The 12-digit UPCs were converted by adding a 0 to the beginning.

35 Universal Product Code (UPC) The 12 digit UPC used in the US paved the way for the 13 digit EAN used in Europe, which became the world-wide standard. The 12-digit UPCs were converted by adding a 0 to the beginning. The check digit for a 13-digit EAN number is selected so that a 1 +3a 2 +a 3 +3a 4 +a 5 +3a 6 +a 7 +3a 8 +a 9 +3a 10 +a 1 1 +3a 12 +a 13 ends with a 0. The 0 added to the beginning doesnt affect the check digit.

36 Universal Product Code (UPC) The 12 digit UPC used in the US paved the way for the 13 digit EAN used in Europe, which became the world-wide standard. The 12-digit UPCs were converted by adding a 0 to the beginning. The check digit for a 13-digit EAN number is selected so that a 1 +3a 2 +a 3 +3a 4 +a 5 +3a 6 +a 7 +3a 8 +a 9 +3a 10 +a 11 +3a 12 +a 1 3 ends with a 0. The 0 added to the beginning doesnt affect the check digit. The coefficient 3 for the terms with even subscripts is called a weight. Because 1a i = a i, we say that terms with odd subscripts have weight 1.

37 Error Detection in UPC Check digit schemes that use weighted sums can be used to find a digit that has been corrupted in some way.

38 Error Detection in UPC Check digit schemes that use weighted sums can be used to find a digit that has been corrupted in some way. Example: If the packaging for a product with UPC 1 650002 202034 was damaged or defective in such a way that the second digit was unintelligible, how would we know that it is supposed to be 6?

39 Error Detection in UPC Example continued:

40 Error Detection in UPC Example continued: Lets call the missing digit X

41 Error Detection in UPC Example continued: Lets call the missing digit X 1+3X+4+3(0)+0+3(0)+2+3(2)+0+3(2)+0 +3(3)+4= 3X+32

42 Error Detection in UPC Example continued: Lets call the missing digit X 1+3X+4+3(0)+0+3(0)+2+3(2)+0+3(2)+0 +3(3)+4= 3X+32 It has to end in zero.

43 Error Detection in UPC Example continued: Lets call the missing digit X 1+3X+4+3(0)+0+3(0)+2+3(2)+0+3(2)+0 +3(3)+4= 3X+32 It has to end in zero. 6 is the only digit that makes this true.

44 Error Detection in UPC Example continued: Lets call the missing digit X 1+3X+4+3(0)+0+3(0)+2+3(2)+0+3(2)+0+3( 3)+4= 3X+32 It has to end in zero. 6 is the only digit that makes this true. This example also shows why the weight 3 is superior to weight 2. If we used weight 2 there would have been other possibilities: 2X+32; X=4 and X=9.

45 Bank Identification Numbers The US banking system uses a variation of UPC scheme.

46 Bank Identification Numbers The US banking system uses a variation of UPC scheme. Every bank has an 8-digit routing number, together with a 9 th check digit as the last digit of the following:

47 Bank Identification Numbers The US banking system uses a variation of UPC scheme. Every bank has an 8-digit routing number, together with a 9 th check digit as the last digit of the following: 7a 1 +3a 2 +9a 3 +7a 4 +3a 5 +9a 6 +7a 7 +3a 8 +9a 9

48 Example The First Chicago Bank has the routing number 07100001_ on the bottom of all of its checks. What is the check digit?

49 Example The First Chicago Bank has the routing number 07100001_ on the bottom of all of its checks. What is the check digit? 7(0)+3(7)+9(1)+7(0)+3(0)+9(0)+7(0)+3(1)= 33

50 Example The First Chicago Bank has the routing number 07100001_ on the bottom of all of its checks. What is the check digit? 7(0)+3(7)+9(1)+7(0)+3(0)+9(0)+7(0)+3(1)= 33 How can we make this end in zero?

51 Example The First Chicago Bank has the routing number 07100001_ on the bottom of all of its checks. What is the check digit? 7(0)+3(7)+9(1)+7(0)+3(0)+9(0)+7(0)+3(1)= 33 How can we make this end in zero? 9x+33

52 Example The First Chicago Bank has the routing number 07100001_ on the bottom of all of its checks. What is the check digit? 7(0)+3(7)+9(1)+7(0)+3(0)+9(0)+7(0)+3(1)= 33 How can we make this end in zero? 9x+33 x=3 because 9(3)=27 and 27+33=60

53 Advantages to Using 3 Weights It detects 100% of single position errors and some transposition errors involving adjacent digits.

54 Advantages to Using 3 Weights It detects 100% of single position errors and some transposition errors involving adjacent digits. This scheme will also detect most transposition errors in the form of abc cba, where as the UPC scheme does not.

55 Codabar This is one of the most efficient error- detection methods, and is used by all major credit-card companies.

56 Codabar This is one of the most efficient error- detection methods, and is used by all major credit-card companies. For a credit card a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 10 a 11 a 12 a 13 a 14 a 15 let T be the number of digits in odd numbered positions that exceed 4.

57 Codabar This is one of the most efficient error- detection methods, and is used by all major credit-card companies. For a credit card a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 10 a 11 a 12 a 13 a 14 a 15 let T be the number of digits in odd numbered positions that exceed 4. The check digit a 16 is chosen so that 2a 1 +a 2 +2a 3 +a 4 +2a 5 +a 6 +2a 7 +a 8 +2a 9 +a 10 +2 a 11 +a 12 +2a 13 +a 14 +2a 15 +T+a 16 is divisible by 10.

58 Example Suppose a bank wants to issue a credit card numbered 312560019643001.

59 Example Suppose a bank wants to issue a credit card numbered 312560019643001. The sum is 66.

60 Example Suppose a bank wants to issue a credit card numbered 312560019643001. The sum is 66. We then note that among the digits in odd-numbered positions, 2 are above 4, so we add 2 to 66, giving us 68.

61 Example Suppose a bank wants to issue a credit card numbered 312560019643001. The sum is 66. We then note that among the digits in odd-numbered positions, 2 are above 4, so we add 2 to 66, giving us 68. Finally, the check digit is whatever is needed to bring the final tally to a number that ends in 0.

62 Example Suppose a bank wants to issue a credit card numbered 312560019643001. The sum is 66. We then note that among the digits in odd- numbered positions, 2 are above 4, so we add 2 to 66, giving us 68. Finally, the check digit is whatever is needed to bring the final tally to a number that ends in 0. Our check digit here is 2.

63 Error Detection This method allows computers to detect 100% of single position errors and about 98% of all other common errors.

64 Error Detection This method allows computers to detect 100% of single position errors and about 98% of all other common errors. A check digit offers partial protection against fraudulent numbers. A person who wanted to create a phony card would have to know the appropriate check digit scheme to be successful.

65 Error Detection This method allows computers to detect 100% of single position errors and about 98% of all other common errors. A check digit offers partial protection against fraudulent numbers. A person who wanted to create a phony card would have to know the appropriate check digit scheme to be successful. The algorithm is called the Luhn Algorithm, after IBM scientist Hans Peter Luhn, who created it in 1953. It can be applied to identification numbers of lengths other than 15, as well.

66 A Multiplication by 13 Scheme The third most common error is one of the form abc cba. This is called a jump transposition, and most commonly occurs in dialing phone numbers.

67 A Multiplication by 13 Scheme The third most common error is one of the form abc cba. This is called a jump transposition, and most commonly occurs in dialing phone numbers. There is a simple way to encode ID numbers so that the three most common errors are detected 100% of the time.

68 Multiplication by 13 Example: Suppose a teacher wants to post student grades publicly without revealing any information about the students ID numbers.

69 Multiplication by 13 Example: Suppose a teacher wants to post student grades publicly without revealing any information about the students ID numbers. Assuming the last four digits of each student ID number are different, the teacher could assign each student a six- digit number by multiplying the last four digits of their ID numbers by 13 (adding leading zeros when necessary).

70 Multiplication by 13 Example: Suppose a teacher wants to post student grades publicly without revealing any information about the students ID numbers. Assuming the last four digits of each student ID number are different, the teacher could assign each student a six-digit number by multiplying the last four digits of their ID numbers by 13 (adding leading zeros when necessary). A student with an ID number that ends with 8912 gets 115856=8912x13. If a jump transition error occurs, it can be detected because 115658 is not divisible by 13.

71 The ZIP Code This system was established in 1963. The numbers begin with 0s (farthest east, Adjuntas, Puerto Rico) and work up to 9s (farthest west, Ketchikan, Alaska).

72 The ZIP Code This system was established in 1963. The numbers begin with 0s (farthest east, Adjuntas, Puerto Rico) and work up to 9s (farthest west, Ketchikan, Alaska). The first digit represents one of the 10 geographic areas. The second two digits identify a central mailing distribution point known as a sectional center. The last two digits indicate the town or local post office.

73 The ZIP Code This system was established in 1963. The numbers begin with 0s (farthest east, Adjuntas, Puerto Rico) and work up to 9s (farthest west, Ketchikan, Alaska). The first digit represents one of the 10 geographic areas. The second two digits identify a central mailing distribution point known as a sectional center. The last two digits indicate the town or local post office. 1983: Four more digits were added after a dash, called the ZIP + 4 code.

74 Bar Codes A bar code is a series of dark bars and light spaces that represent characters.

75 Bar Codes A bar code is a series of dark bars and light spaces that represent characters. They are decoded by scanning with a light. The dark bars reflect very little back, and the white reflects a lot. They are converted into 0s and 1s. This is called binary coding.

76 Bar Codes A bar code is a series of dark bars and light spaces that represent characters. They are decoded by scanning with a light. The dark bars reflect very little back, and the white reflects a lot. They are converted into 0s and 1s. This is called binary coding. The simplest bar code is the Postnet code, used by the USPS and are commonly found on Business Reply Cards. They use a similar check and must add up to something divisible by 10.

77 Postnet Codes

78 Error Detection There are 5 bars per digit and there are exactly 10 arrangements composed of two long bars and three short bars.

79 Error Detection There are 5 bars per digit and there are exactly 10 arrangements composed of two long bars and three short bars. The numbers are separated into blocks for ease of understanding.

80 Example

81 The sixth block is an incorrect one because it has only one long bar. To correct the error, the computer linked with the bar- code scanner sums the remaining 9 digits to obtain 31.

82 Example The sixth block is an incorrect one because it has only one long bar. To correct the error, the computer linked with the bar-code scanner sums the remaining 9 digits to obtain 31. Because the sum of all 10 digits ends in 0, the value must be 9.

83 Encoding Personal Data The social security number has no personal data encoded in the number. It is entirely determined by the place and time that it is issued.

84 Encoding Personal Data The social security number has no personal data encoded in the number. It is entirely determined by the place and time that it is issued. In contrast, some states drivers license numbers are determined entirely by personal information about the holders.

85 Encoding Personal Data The social security number has no personal data encoded in the number. It is entirely determined by the place and time that it is issued. In contrast, some states drivers license numbers are determined entirely by personal information about the holders. Coding license numbers solely from personal data enables automobile insurers, government entities, and law enforcement agencies to determine the number from the personal data.

86 Soundex Coding System This is used to encode a surname.

87 Soundex Coding System This is used to encode a surname. 1. delete all occurrences of h and w. (Schworer becomes Scorer and Hughgill becomes uggill.)

88 Soundex Coding System This is used to encode a surname. 1. delete all occurrences of h and w. (Schworer becomes Scorer and Hughgill becomes uggill.) 2. Assign number to the remaining letters as follows: a,e,i,o,u,y 0 b,f,p,v 1 c,g,j,k,q,s,x,z 2 d,t 3 l 4 m,n 4 r 6

89 Soundex Coding System This is used to encode a surname. 1. delete all occurrences of h and w. (Schworer becomes Scorer and Hughgill becomes uggill.) 2. Assign number to the remaining letters as follows: a,e,i,o,u,y 0 b,f,p,v 1 c,g,j,k,q,s,x,z 2 d,t 3 l 4 m,n 4 r 6 3. If two or more letters with the same numeric value are adjacent, omit all by the first. (Scorer becomes Sorer and uggill become ugil)

90 Soundex Coding System 4. Delete the first character of the original name if still present (Sorer becomes orer)

91 Soundex Coding System 4. Delete the first character of the original name if still present (Sorer becomes orer) 5. Delete all occurrences of a, e, i, o, u, and y.

92 Soundex Coding System 4. Delete the first character of the original name if still present (Sorer becomes orer) 5. Delete all occurrences of a, e, i, o, u, and y. 6. Retain only the first three digits corresponding to the remaining letters; append trailing 0s if fewer than 3 letters remain; precede the three digits obtained in this step with the first letter of the surname.

93 Soundex Coding System This is an error-correcting scheme. It is designed so that likely misspellings of a name result in the correct coding of the name. For example, Erickson, Eriksen, Ericson, and Ericsen all yield the same coding as Erickson.

94 Soundex Coding System This is an error-correcting scheme. It is designed so that likely misspellings of a name result in the correct coding of the name. For example, Erickson, Eriksen, Ericson, and Ericsen all yield the same coding as Erickson. It was originally designed for the U.S. Census Bureau when much census information was obtained orally.

95 Personal Information in Drivers License Numbers The last five digits of Illinois and Florida drivers license numbers capture the year and date of birth as well as the sex.

96 Personal Information in Drivers License Numbers The last five digits of Illinois and Florida drivers license numbers capture the year and date of birth as well as the sex. Illinois: each day of the year is assigned a three digit number in sequence beginning with 001 for January 1. All months are assumed to have 31 days, so March 1 is 063. For females the scheme is identical but 600 is added to the number.

97 Personal Information in Drivers License Numbers The last two digits of the birth year, separated by a dash are listed in the fifth and fourth positions from the end of the drivers license number. Thus, a male born October 13, 1940 would have the last five digits 4-0292, whereas a female would have 4-0892.

98 Homework Determine the check digit for a money order with identification number 3953981640.

99 Homework Determine your surname code using the Soundex Coding System. Also change your birthday and gender to the code used on an Illinois drivers license.

100 Thank you for your attention


Download ppt "Chapter 16 in COMAP Book Jocelyn Westray. Objectives Understand what a check digit is. Systems dividing by 7 and 9. Systems with weights. Codabar method."

Similar presentations


Ads by Google