Question 4
Note here that the 'interchanged' digits are not adjacent, so the
basic analysis the book gives us doesn't apply. The UPC code is probably
easier to understand here -- since in both numbers (157... and 751...) the
1 and 7 are in odd positions, and the 5 is in an even position, the result
of the formula will be the same for both numbers (the sum of the odd
numbers will be the same (as will 3 times this sum), and the sum of the
even numbers will be the same). So the UPC scheme will produce the smae
check digit for the invalid number as for the valid number.
For the airline scheme, we can't quite figure what the check digit is, but
what happens if we try? We're supposed to divide the number by 7, so how
far can we get if we start doing the long division? 7 into 157 is 22
remainder 3 -- that doesn't tell us much, but let's see what 7 into 751
is: we get 107 remainder 2. Now if the rest of the digits are the same,
the final remainder is going to be different -- in one case we're
continuing with a remainder of 3 and in the other we're going from a
remainder of 2. (To visualize this best, start doing the long division by
hand, and work an example where you provide the rest of the digits (same
for both numbers).
Question 5
Now we're in the opposite situation. If we start applying the UPC formula
to these numbers, in the first case (751...) we have 3*(7+1) + 5 = 29;
while in the other case (571...) we have 3*(5+1) + 7 = 25. Since the rest
of the digits are the same, the total values for each of these numbers
will be different by 4, which means they'll have different check digits
(and so the error will be detected).
For the money order scheme, we try to divide again, this time by 9. 9 into
751 is 83 remainder 4; 9 into 571 is 63 remainder 4. Since the remainders
are the same, and the rest of the digits are the same, the final remainder
must be the same in both cases (meaning that the error will not be
detected.)