I'm charged with coming up with a formula using the "Luhn check digit formula" for a 10-digit number, calculated as follows: (The check digit is the last number.)
1. Double the value of alternate digits beginning with the first digit.
2. Add 24 to the individual digits of the products resulting from step 1 to the unaffected digits from the original number.
3. Subtract the total obtained in step 2 from the next higher number ending in zero. This is the check digit. If the total obtained in step 2 is a number ending in zero, the check digit is zero.
Example: Number is 1234567893
1 2 3 4 5 6 7 8 9 3
2 6 10 14 18 (step 1)
24+2+2+6+4+1+0+6+1+4+8+1+8=67 (step 2)
70-67=3 (step 3)
I'm not getting anywhere with my attempts, and the formula is getting uglyier (is that a word?) with each attempt. Any help from the board would be much appreciated! Thanks in advance, and sorry for the long post...
1. Double the value of alternate digits beginning with the first digit.
2. Add 24 to the individual digits of the products resulting from step 1 to the unaffected digits from the original number.
3. Subtract the total obtained in step 2 from the next higher number ending in zero. This is the check digit. If the total obtained in step 2 is a number ending in zero, the check digit is zero.
Example: Number is 1234567893
1 2 3 4 5 6 7 8 9 3
2 6 10 14 18 (step 1)
24+2+2+6+4+1+0+6+1+4+8+1+8=67 (step 2)
70-67=3 (step 3)
I'm not getting anywhere with my attempts, and the formula is getting uglyier (is that a word?) with each attempt. Any help from the board would be much appreciated! Thanks in advance, and sorry for the long post...