IBM Mod 10 and 11 check digits
https://en.wikipedia.org/wiki/Luhn_algorithm
The Luhn algorithm will detect any single-digit error, as well as almost all transpositions of adjacent digits.
Positions are counted from the farthest right digit (not including the check digit).
To calculate the Modulus 10 self-check digit, do the following:
1.Multiply the units position and every alternate position of the base number by 2.
2.Add the digits in the products to the digits in the base number that were not multiplied.
3.Subtract the sum from the next higher number ending in zero.
The difference is the self-check digit.
For example:
Base number 6 1 2 4 8
Units and every alternate position: 6 2 8
Multiply by the weight factor, 2 x2 x2 x2
Products: 12 4 16
Digits not multiplied: 1 4
Add the digits of the products and the digits from the base number
not used for multiplication
1+2 +1 +4 +4 +1+6
=19
Next higher number ending in 0: 20
Subtract sum of digits -19
Self-check digit: 1
(or 10 - sum-of-digits MOD10)
To calculate the Modulus 11 self-check digit, do the following:
1.Assign a weight factor to each digit position of the base number. These factors are: 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, . . . starting with the units position of the number and progressing toward the high-order digit. For example, the base number 991246351 would be assigned the weight factors as follows:
Base number 9 9 1 2 4 6 3 5 1
Weight factors 4 3 2 7 6 5 4 3 2
2.Multiply each digit by its weight factor.
3.Add the products.
4.Divide this sum by 11.
5.Subtract the remainder from 11.
The difference is the self-check digit.
For example:
Base number
1 3 7 3 9
Weight factors
x6 x5 x4 x3 x2
Multiply each digit by its weight factor
6 15 28 9 18
Add the products
6 + 15 + 28 + 9 + 18 = 76
Divide the sum by 11
76/11 = 6 plus a remainder of 10
Subtract the remainder from 11
11 - 10 = 1
Self-check digit
1
Note: If the remainder in step 4 is 11, the self-check digit is 0. If the remainder is 10, the base number has no self-check digit; you must make sure that such base numbers are not used in the fields you define as self-check fields.