Check Digits in Payroll or Stock NumbersDate: 11/16/96 at 18:28:36 From: Nigel Tombs Subject: Check Digits Hi Dr. Math: Have you ever used or do you know about check digits? They appear in payroll numbers or stock numbers. I understand it's a unique single digit number that is placed as the last number of a series of numbers and is made from a calculation involving all of the other numbers. A computer checks the last digit to verify that it is a correctly entered stock number from a user input. If the user enters an incorrect number, the transaction will be rejected. For example: stock number 4793769(?), where (?) is the calculated digit. What is the set of calculations required to get the unique single digit number? Does the computer generate it automatically? I assume the user does not see the last digit since only the computer program is concerned with it. Thanks in advance for any answers or theory you may provide. Nigel, Swindon, England Date: 11/16/96 at 19:10:03 From: Doctor Mike Subject: Re: Check Digits Hello Nigel, Yes, I am familiar with check digits that are used for many things. One example that I ran across recently has to do with SIN numbers, which are Social Insurance Numbers for citizens of Canada. Look at the web site: http://www.revcan.ca/E/pub/gd/402895et/402895e.txt and search for the text string "check digit". This gives the calculation actually used by the government for calculating the 9th digit from the first 8 digits. It is pretty involved, and I don't know why they didn't choose something a little simpler, but that is what they use. There are many different calculations for producing a check digit, and not just one standard one. In fact, some calculations may be kept secret for security reasons. A very simple one that could be used for checking for data entry errors would be to add up the other digits, and take the units digit of that result as the check digit. Using this process with your example 4793769(?) would give 47937695 since the other digits add up to 45. This is NOT a very good check digit algorithm because it fails to catch a very common mistake of switching adjacent digits. If instead of entering 47937695 you entered 47973695, you would not catch this with the simple check digit algorithm. The reason is that the other digits added up in ANY order still give 45, so 5 would still be the check digit. This is one reason for a more involved check digit calculation like the one in the Canadian system. I hope this helps. -Doctor Mike, The Math Forum Check out our web site! http://mathforum.org/dr.math/ |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/