July 23, 1992|By Joseph A. Gallian

YOU'VE seen bar coded numbers on everything from milk cartons to rental cars. And long numbers on everything from credit cards to airline tickets. Of course these numbers function as identification numbers just as Social Security numbers and serial numbers on currency do.

Because of inexpensive, fast, reliable computers, the identification numbers used by businesses today are more sophisticated than those of earlier years. Modern identification numbers have a built-in "check" to partially insure that the numbers have been correctly entered into a computer or have been correctly scanned by an optical device.

Let's look at a number such as 0 38000 00127 7 found on the bottom of a box of corn flakes. Suppose this number were entered into a computer as 0 58000 00127 7 (a mistake in the second position). How would the computer recognize the mistake?

Easier than you think: It is programmed to carry out the following computation: Add the digits in positions 1, 3, 5, 7, 9, 11 and triple the result; then add this tally to the sum of the remaining digits. If the result doesn't end with a zero, the computer knows the entered number is incorrect.

For the incorrect corn flakes number, we have: (0+8+0+0+1+7) times 3 plus (5+0+0+0+2+7) = 48 + 14 = 62. Notice that had we used the correct digit 3 in the second position instead of 5, the sum would have ended in a zero, as it should. This simple scheme will detect over 90 percent of all possible errors.

A simpler but somewhat less effective method is used on airline tickets and UPS packages. For these a serial number such as 845088540 is assigned an extra digit that is the remainder of the serial number upon dividing by 7. Since the remainder when dividing 845088540 by 7 is 2, this number would appear on the package as 845088540 2.

Now let us say that the incorrect number 854088540 2 were entered into a computer. (The second and third digits have been interchanged.) The computer divides 854088540 by 7 and obtains a remainder of 4 instead of 2. Thus the error is detected.

One of the most efficient identification methods is used by nearly all credit cards. Say a bank intends to issue a credit card with the identification number 3125600196431. It must then add an extra digit for error detection.

This is done as follows: The digits in positions 1, 3, 5, 7, 9, 11, 13 and 15 are added and the result is doubled: (3+2+6+0+9+4+1) times 2 = 50. Next, count the number of digits in positions 1, 3, 5, 7, 9, 11, 13 and 15 that exceed 4 and add this to the total. For our example, only 6 and 9 exceed 4, so the count is 2 and our running total is 52. Now add in the remaining digits: 52 + (1+5+0+1+6+3) = 68.

The check digit is whatever is needed to bring the final tally to a number that ends with 0. Since 68 + 2 = 70, the check digit for our example is 2. This digit is appended to the end of the number the bank issues for identification purposes. Errors are then detected this way: A computer sums the digits in the odd-numbered positions and doubles the result. It then counts how many of the digits in the odd positions exceed 4 and adds this to the total. Finally, it adds in the remaining digits, including the check digit.

If the correct number is entered into a computer, the result will end in a zero. If the result doesn't end with a zero, a mistake has been made or perhaps there has been attempted fraud. This method allows computers to detect better than 98 percent of the most common errors.

Besides detecting errors, the check digit offers partial protection against fraudulent numbers. A person who wanted to create a phony credit card, bank account or driver's license number would have to know the check digit scheme I've described here in order to cheat the computer.

Joseph A. Gallian is a mathematician at the University of Minnesota, Duluth, and author of "Contemporary Abstract Algebra."