Content deleted Content added
Tag: Reverted |
Undid revision 1180535409 by 2003:C3:C735:BE00:588:27C9:ED5F:72CF (talk) |
||
Line 9:
The check digit is computed as follows:
# If the number already contains the check digit, drop that digit to form the "payload". The check digit is most often the last digit.
# With the payload, start from the rightmost digit. Moving left, double the value of every second digit (including the rightmost digit).
# Sum the values of the resulting digits.
# The check digit is calculated by <math>(10 - (s \operatorname{mod} 10)) \operatorname{mod} 10</math>, where s is the sum from step 3. This is the smallest number (possibly zero) that must be added to <math>s</math> to make a multiple of 10. Other valid formulas giving the same value are <math>9 - ((s + 9)\operatorname{mod} 10)</math>, <math>(10 - s)\operatorname{mod} 10</math>, and <math>10\lceil s/10\rceil - s</math>. Note that the formula <math>(10 - s)\operatorname{mod} 10</math> will not work in all environments due to differences in how negative numbers are handled by the [[modulo]] operation.
|