1) Method to find ISBN-13 check digit:
The calculation of an ISBN-13 check digit begins with the first 12 digits of the thirteen-digit ISBN(thus excluding the check digit itself). Each digit, from left to right, is alternately multiplied by 1 or 3, then those products are summed modulo 10 to give a value ranging from 0 to 9. Subtracted from 10, that leaves a result from 1 to 10. A zero(0) replaces a ten(10), so, in all cases, a single check digit results.
Formally, using modular arithmetic, we can say:
(x1 + 3x2 + x3 + 3x4 + x5 + 3x6 + x7 + 3x8 + x9 + 3x10 + x11 +3x12 + x13 ) 0 (mod 10).
find ISBN-13 check digit of 978-971-0499-31-
s=(9x1) +(7x3) + (8x1) + (9x3) + (7x1) + (1x3) + (0x1) + (4x3) + (9x1) + (9x3)+ (3x1)+ (1x3)
=9 + 21 + 8 + 27 + 7 + 3 + 0 + 12 + 9 + 27 + 3 + 3
=129
129/10=12 remainder 9
10 - 9= 1
Thus the check digit is 9m and the complete sequence is ISBN 978-971-0499-31-1
2) Here is the step by step procedure to validate the credit card number:
4000 0012 3456 7899
Step-1: Starting with the check digit double the value of every other digit (right to left every 2nd digit)
Step 2 - If doubling of a number results in a two digits number, add up the digits to get a single digit number. This will result in eight single digit numbers.
8+0+0+0+0+0+2+2+6+4+1+6+5+8+9+9=60
If the final sum is divisible by 10, then the credit card number is valid. If it is not divisible by 10, the number is invalid.
In our case as 60/10=6, divisible by 10, hence the given credit card number is valid.
Comments
Leave a comment