Amazoncom keeps track of orders using an 11digit ID 10 of th
Amazon.com keeps track of orders using an 11-digit ID. 10 of these digits are the real identification number, and the 11th digit is the mod 9 check digit. Given the two identification number below, which one of them is valid according to the scheme described, and which is not?
a) 39539881642
b) 39559881642
Solution
I didn’t identify whether the first or last digit is the ensure digit; as it turns out (entirely by chance), if you use the first as the verify digit, the second number will be the suitable order number; if you use the last, the first number will be the applicable order number.
Further more way, this problem is easily solve by taking the whole number except the check digit and dividing it mod 9.
Taking the first number as an example: 3953988164 / 9 = 439332018.22222222222222222222222
We only care about the fractional part of the result (the remainder), which we multiply by 9 to obtain the integer remainder: 0.22222222222222222222222*9 = 1.999999999999999999998 = 2.
which as you can see is the last digit append to the first number, which indicate that the first number is valid. If you do the same procedure for the second number, you’ll get a predicted check digit of 4, but the definite check digit is 2. Therefore the second number is not valid.

