Identification Numbers and Check Digits 1

Similar documents
Check Digit Schemes and Error Detecting Codes. By Breanne Oldham Union University

Check Digits for Detecting Recording Errors in Horticultural Research: Theory and Examples

MII stands for major industry identifier; 4 and 5 indicate Banking and Financial. VISA cards begin with 4 and MasterCard cards with 5.

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

The College Mathematics Journal, Vol. 22, No. 3. (May, 1991), pp

Some facts about polynomials modulo m (Full proof of the Fingerprinting Theorem)

MACM 101 Discrete Mathematics I

8 Primes and Modular Arithmetic

Not for resale. 4.1 Divisibility of Natural Numbers 4.2 Tests for Divisibility 4.3 Greatest Common Divisors and Least Common Multiples

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: b + 90c = c + 10b

Primes. Name Period Number Theory

A Short Guide to Significant Figures

MBA Jump Start Program

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

SECTION P.5 Factoring Polynomials

Welcome to Math Video Lessons. Stanley Ocken. Department of Mathematics The City College of New York Fall 2013

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Breaking The Code. Ryan Lowe. Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and

Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test

Flaws & Frauds Hindering Credit Cards Security

SOLUTIONS FOR PROBLEM SET 2

APPLICATIONS AND MODELING WITH QUADRATIC EQUATIONS

Stupid Divisibility Tricks

A Prime Investigation with 7, 11, and 13

= = 3 4, Now assume that P (k) is true for some fixed k 2. This means that

Accuplacer Arithmetic Study Guide

Applications of Fermat s Little Theorem and Congruences


Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University

Section 6.1 Factoring Expressions

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points.

Session 7 Fractions and Decimals

Revised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)

k, then n = p2α 1 1 pα k

9.2 Summation Notation

Definitions 1. A factor of integer is an integer that will divide the given integer evenly (with no remainder).

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification:

Math 319 Problem Set #3 Solution 21 February 2002

The Mathematics of the RSA Public-Key Cryptosystem

Primes in Sequences. Lee 1. By: Jae Young Lee. Project for MA 341 (Number Theory) Boston University Summer Term I 2009 Instructor: Kalin Kostadinov

SECTION 0.6: POLYNOMIAL, RATIONAL, AND ALGEBRAIC EXPRESSIONS

LAMC Beginners Circle: Parity of a Permutation Problems from Handout by Oleg Gleizer Solutions by James Newton

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

Pre-Calculus II Factoring and Operations on Polynomials

Integer roots of quadratic and cubic polynomials with integer coefficients

Enhance Luhn Algorithm for Validation of Credit Cards Numbers

Computing exponents modulo a number: Repeated squaring

Binary Representation

Return on Investment (ROI)

Faster deterministic integer factorisation

Number Representation

Chapter 1. Computation theory

IV. ALGEBRAIC CONCEPTS

MATH 90 CHAPTER 1 Name:.

IBM SPSS Direct Marketing 22

Notes on Factoring. MA 206 Kurt Bryan

JUST THE MATHS UNIT NUMBER 1.8. ALGEBRA 8 (Polynomials) A.J.Hobson

MATHEMATICAL EXCURSIONS Math and Bar Codes

An Efficient RNS to Binary Converter Using the Moduli Set {2n + 1, 2n, 2n 1}

mod 10 = mod 10 = 49 mod 10 = 9.

If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?

2) Write in detail the issues in the design of code generator.

Design: a mod-8 Counter

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

3.1. RATIONAL EXPRESSIONS

FTS Real Time Client: Equity Portfolio Rebalancer

EVALUATING ACADEMIC READINESS FOR APPRENTICESHIP TRAINING Revised For ACCESS TO APPRENTICESHIP

Laser Scanner Programming Guide (SE923 laser engine)

SOLVING QUADRATIC EQUATIONS - COMPARE THE FACTORING ac METHOD AND THE NEW DIAGONAL SUM METHOD By Nghi H. Nguyen

Accounts Receivable User Manual

Section 4.1 Rules of Exponents

Register your product and get support at DPM8500. Barcode scanner configuration guide

SUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by

Automated Inventory System. Barcode User Guide

1 Description of The Simpletron

Databases in Microsoft Access David M. Marcovitz, Ph.D.

Properties of Real Numbers

Continued Fractions and the Euclidean Algorithm

6.1 The Greatest Common Factor; Factoring by Grouping

Unit 2 The Basic Accounting Cycle

PRIMARY CONTENT MODULE Algebra I -Linear Equations & Inequalities T-71. Applications. F = mc + b.

Cryptography and Network Security Chapter 8

Programming Reference Guide HP USB Barcode Scanner

APPENDIX D PHN CHECK DIGIT NUMBER ROUTINE

Click on the links below to jump directly to the relevant section

Settling Multiple Debts Efficiently: Problems

On the generation of elliptic curves with 16 rational torsion points by Pythagorean triples

FACTORING OUT COMMON FACTORS

This is Factoring and Solving by Factoring, chapter 6 from the book Beginning Algebra (index.html) (v. 1.0).

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering

Guidance paper - The use of calculators in the teaching and learning of mathematics

NSM100 Introduction to Algebra Chapter 5 Notes Factoring

IBM SPSS Direct Marketing 23

RSA Encryption. Tom Davis October 10, 2003

Lies My Calculator and Computer Told Me

Accounts Payable System Administration Manual

Transcription:

Identification Numbers and Check Digits 1 Many products or documents today have an identification number stamped. This numbers codes information about the product. Some examples: 1. Credit Cards 2. Postal service (ZIP and Bar Codes) 3. Grocery items (UPC) 4. Money orders 5. Dollar bills 6. Books (ISBN) 7. Driver licenses 8. Vehicle Identification Numbers A Check Digit is a decimal (or alphanumeric) digit added to a number for the purpose of detecting the sorts of errors humans typically make on data entry. It is not uncommon to make errors when handling numbers; like writing down a phone number, giving out a credit card number, writing down a street address, and so on. Even machines, like magnetic readers, are prone to errors. Some of the typical errors are of the following three types: 1. A single digit error For example, writing a 1 instead of a 7 somewhere in the number. This is the most common type of error, accounting for 60% to 90% of all errors. 1. Suppose that you have certain amount of money in your bank account. Lets say that you have a quantity between $1 and $1000. If you make a single digit error when balancing your checkbook, what is the greatest possible difference between your total and your bank s total? What is the least possible difference? 1 Supported by NSF Grant 0502258 March 1, 2009 1

2. A transposition error where you reverse the order of two adjacent digits: for example, writing 51 instead of 15 somewhere in the number. 2. Why is this true? If you make a transposition error when writing down a number, then the difference between this number and the original number is a multiple of 9. 3. A jump transposition error in which two non-adjacent digits are switched, for example you write 537 instead of 735. 3. Can you devise a divisibility rule for detecting a jump transposition error? A more detailed analysis and categorization of the sort of errors incurred when dealing with numbers was reported by J. Verhoeff (Error Detecting Decimal Codes, Mathematical Centre Tract 29, The Mathematical Centre, Amsterdam, 1969) based on a study of 12000 errors: 1. single errors: a becomes b (60% to 95% of all errors) 2. omitting or adding a digit (10% to 20%) 3. adjacent transpositions: ab becomes ba (10% to 20%) 4. twin errors: aa becomes bb (0.5% to 1.5%) 5. jump transpositions: acb becomes bca (0.5% to 1.5%) 6. jump twin errors: aca becomes bcb (below 1%, lower for longer jumps) 7. phonetic errors: a0 becomes 1a, since the two have similar pronunciations in some languages, e.g. thirty and thirteen (0.5% to 1.5%) March 1, 2009 2

The Check Digit and Check Equation We can eliminate (or easily detect) the problem of omitting or adding digits by restricting the input field to a given number of digits if we are dealing with numbers which are fixed in format, such as credit card numbers, Social Insurance Numbers, local phone numbers, and student ID numbers. A method (Check Digit Scheme) for eliminating some of the other type of errors is the following. To an identification number a new digit is appended (usually as the last on the right) so that all the digits satisfy a predetermined equation, the Check Equation. Other errors are detected by calculating whether the check equation for a particular check digit scheme is true. The check digit is included in the equation so that it is protected against errors as well. If the equation is not true, an error is present; if it is true, there may or may not be an error. A number of different check digit schemes for detecting decimal number errors have been suggested, and several are in common use. We examine some of these schemes in the following pages. US Postal Money orders The US Post Office uses an identification number system for postal money orders. The identification number is 11 digits long, the last digit being the check digit. Thus, if the printed number on the money order is a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 10 a 11, then a 1 + a 2 + a 3 + a 4 + a 5 + a 6 + a 7 + a 8 + a 9 + a 10 = a 11 (mod 9) For example, the money order on the left has identification number 8431032502 and check digit 1. The sum 8 + 4 + 3 + 1 + 0 + 3 + 2 + 5 + 0 + 2 = 28 and 28 = 3 9 + 1 has remainder 1 after dividing by 9. The check digit is 1. 4. The image of the money order on the right has been digitally altered and the check digit is missing. What is it? March 1, 2009 3

5. What type of errors does the US Postal Money order identification scheme detect? Suppose that a money order has the number 27120241168 and you erroneously copy that number as in the table below Copied Number Error Type Detected? (Yes or No) 27120241168 27129241168 27123241168 21720241168 27120241186 UPC (Universal Product Code) Grocery products use the so called UPC system for identifying products. A UPC number consists of 12 digits: 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 structure of the UPC is described in this picture The first digit a 1 identifies the type of product, the next five digits a 2 a 3 a 4 a 5 a 6 identify the manufacturer, and the next five digits a 7 a 8 a 9 a 10 a 11 identify the product. The last digit a 12 is the check digit, and it must satisfy: 3 a 1 + a 2 + 3 a 3 + a 4 + 3 a 5 + a 6 + 3 a 7 + a 8 + 3 a 9 + a 10 + 3 a 11 + a 12 0 (mod 10). March 1, 2009 4

Digit a 1 Type of Product 0 General Groceries 2 Meat and Produce 3 Drugs and Health products 4 Non-food items 5 Coupons 6, 7 Other items 6. (a) Determine the check digit (?) for the UPC number 05074115017? (b) A box of corn-flakes has printed the following UPC code: 058000001277. Is this correct? (c) The UPC code 034?81923147 is missing a number (in the?-position). What is this number? March 1, 2009 5

7. The mod 9 scheme of the US Postal Money orders was not able to detect all of the single-digit errors, but the mod 10 UPC scheme does. Suppose that the following UPC 036000291452 is scanned resulting in the single digit errors below: (a) 038000291452 (b) 036000291453 Which of the errors is detected? ISBN International Standard Book Number The International Standard Book Number (ISBN) uses a weighted code: Each digit is weighted according to its position in the number and the check digit is chosen so the weighted sum is evenly divisible by a prime number. An ISBN number consists of 10 digits a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 10 so that the rightmost digit a 10 satisfies the equation 10 a 1 + 9 a 2 + 8 a 3 + 7 a 4 + 6 a 5 + 5 a 6 + 4 a 7 + 3 a 8 + 2 a 9 + 1 a 10 0 (mod 11) If the check digit a 11 is 10, then the letter X is used instead. The ISBN 10 digit number consists of four parts. These parts may be of differen lengths, and are usually separated by hyphens. 1. the group identifier (language-sharing country group), 2. the publisher code, 3. the item (title) number, and 4. a check digit. The group identifier is a 1 to 5 digit number. The single first digit group identifiers are: 0 or 1 for English-speaking countries; 2 for French-speaking countries; 3 for German-speaking countries; 4 for Japanese; 5 for Russian; 7 for Chinese; and 8 for Spanish. March 1, 2009 6

For example, the ISBN for my book Foliations I is 0-8218-0809-5 and the check equation is 10 0 + 9 8 + 8 2 + 7 1 + 6 8 + 5 0 + 4 8 + 3 0 + 2 9 + 1 5 (mod 11) = 198 (mod 11) = 0 This scheme detects any single error and the transposition of any two digits at any distance (assuming the overall number is 10 or fewer digits long). 8. Determine the check digit a 10 for the ISBN 0-669-33907? 9. Using the ISBN check digit scheme, determine which of the following are valid ISBN numbers (a) 3-824-27519-X (b) 84-206-3613-4 (c) 2729-60284-0 10. The ISBN 0-669-03925-4 is the result of the transposition of two adjacent digits not involving the first or last digit. Determine the correct ISBN. March 1, 2009 7

11. Prove that the ISBN code detects error arising from transposing the 1st and 3rd digits. IBM Check Digit Scheme The IBM Check Digit scheme is used to verifty the validity of credit cars numbers, and other ID numbers. It was created by IBM scientist Hans Peter Luhn, so it is also referred to as Luhn algorithm. This is a weighted code with parity dependent weights. The digits in the even positions (numbering from the right) are multiplied by 2, then reduced to a single digit (if > 9) by casting out nines (subtracting 9, which is equivalent to adding the digits). All digits are then summed and a check digit added to make the result evenly divisible by 10. For example, given the number 5482 0923 1553 0413 the leading 5 is doubled, giving 10, which is then reduced to 1 by adding the digits of 10 together; similarly, the 8 becomes 16 and then 7; the 0 is oblivious to doubling; the 2 becomes 4; the 1 becomes 2; and the 5 in the second to last position becomes 10 and thus 1. Thus the check equation is (5#2 + 4 + 8#2 + 2 + 0#2 + 9 + 2#2 + 3 + 1#2 + 5 + 5#2 + 3 + 0#2 + 4 + 1#2 + 3 = 50 = 0 (mod 10) where # represents multiplication modulo 9; for example 6#2 = 12 = 3 (mod 9). This scheme detects all single digit errors. It also detects most adjacent transpositions errors, but not those where 09 becomes 90. It also does not detect jump transposition errors, such as 553 becoming 355. 12. The credit card number 5482 0923 1553 0413 is valid. Determine which of the following errors below are detected by the Luhn algortihm detect and which ones are not detected. Copied Number Error Type Detected? (Yes or No) 5482 0923 2553 0413 5482 0923 1453 0413 5482 9023 1553 0413 5482 0921 3553 0413 5482 0923 1355 0413 March 1, 2009 8

TI-84 Programs The first program will compute the check digit for the ISBN check digit scheme. The program requests 9 digits and outputs a sible digit or the letter X PROGRAM:ISBN :Input N :For(J,1,9) :int(n/10^(9-j)) L 1 (J) :N-L 1 (J) 10^(9-J) N :0 N :For(J,1,9) :N+L 1 (J) (11-J) N :N-int(N/11) 11 N :If N=0 :Disp 0 :If N=1 :Disp X :If N>1 :Disp 11-N The next program implements the Luhn algortihm or IBM Check Digit scheme. Unfortunately, the TI-84 cannot handle 16 digit integers, so it cannot be used to validate credit card numbers, because these usually have 16 digits. It is possible to modify it so that it accepts 16 digit numbers, but that will obscure the nature of the algortihm. The first part of the program (up to line 6) computes the length of the number N. Zeros on the left are ignored. PROGRAM:LUHN :Input N :0 K :While int(n/10^k)>0 :K+1 K :For(J,1,K) :int(n/10^(k-j)) L 1 (K+1-J) :N-int(N/10^(K-J)) 10^(K-J) N :For(J,2,K,2) :If L 1 (J)>4 :2 L 1 (J)-9 L 1 (J) :2 L 1 (J) L 1 (J) :For(J,2,K) :L 1 (1)+L 1 (J) L 1 (1) March 1, 2009 9

:If L 1 (1)-int(L 1 (1)/10) 10=0 :Disp NUMBER OK :Disp INVALID NO March 1, 2009 10