✔ 最佳答案
The final digit of a Universal Product Code is a check digit computed as follows:
A check digit is a form of redundancy check used for error detection, the decimal equivalent of a binary checksum. It consists of a single digit computed from the other digits in the message.
Example
UPC
Add the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three.
Add the digits in the even-numbered positions (second, fourth, sixth, etc.) to the result.
Subtract the result from the next-higher multiple of ten. The answer is the check digit.
For instance, a UPC-A barcode (In this case, a UPC for a box of tissues) "03600029145X" where X is the check digit, X can be calculated by adding the odd-numbered digits (0+6+0+2+1+5 = 14), multiplying by three (14 × 3 = 42), adding the even-numbered digits (42+3+0+0+9+4 = 58) and subtracting from the next-highest multiple of ten (60 - 58 = 2). The check digit is thus 2.
ISBN 10
The final character of a ten digit International Standard Book Number is a check digit computed so that multiplying each digit by its position in the number (counting from the right) and taking the sum of these products modulo 11, is 0. The last digit (which is multiplied by 1) is the check digit, chosen to make the sum correct. It may need to have the value 10, which is represented as the letter X. For example, take the ISBN 0-201-53082-1. The sum of products is 0×10 + 2×9 + 0×8 + 1×7 + 5×6 + 3×5 + 0×4 + 8×3 + 2×2 = 98 modulo 11 (10) subtracted from 11 ≡ 1. So the ISBN is valid.
While this may seem more complicated than the first scheme, it can be validated very simply by adding all the products together then dividing by 11. If the result is an integer then the ISBN is valid.
ISBN 13 (in use January, 2007) generates its check digit the same way as the UPC.
Other examples of check digits
The tenth digit of the National Provider Identifier for the healthcare industry more
The Australian Tax File Number (based on modulo 11)
The ninth digit of a Canadian Social Insurance Number (SIN)
The North American CUSIP number
The International SEDOL number
The International Securities Identifying Number (ISIN)
The International CAS registry number's final digit.
Modulo 10 check digits in credit card account numbers, calculated with the Luhn algorithm.
Also used in the Norwegian KID (customer identification number) numbers used in bank giros (credit transfer).
final digit of a POSTNET code
final digit of an ISSN code
final digit of a DUNS number (though this is scheduled to change, such as that the final digit will be chosen freely in new allocations, rather than being a check digit)
The Spanish fiscal identification number (número de identificación fiscal, NIF), (based on modulo 23).
The ninth digit of a Vehicle Identification Number (VIN).
The ninth digit of an Israeli Teudat Zehut (Identity Card) number.
The 13th digit of Former Yugoslav Unique Master Citizen Number (JMBG)
Compare to check bit.