UPC codes Solutions: finding a check digit, and checking if a code is accurate:
1. Do a check digit calculation mod 10 to decide which of these UPC codes is correct, and which has an error:
A. 0-72512-06868-7
First way of doing it:
0*3+7+2*3+5+1*3+2+0*3+6+8*3+6+8*3+7=90=0 mod 10, so there is is correct
Second way of doing it:
Digits in odd places: 0+2+1+0+8+8=9 ... 9*3=7
Digits in even places (including the check digit): 7+5+2+6+6+7=3
Add them, and compare to 0: 7+3=0 This UPC code is valid/correct
Third way of doing it:
Add up for the first 11 digits: 0*3+7+2*3+5+1*3+2+0*3+6+8*3+6+8*3=83=3; so the check digit should be 0-3=7, which agrees with this check digit, so it is valid.
B. 0-09252-45310-1
First way of doing it:
0*3+0+9*3+2+5*3+2+4*3+5+3*3+1+0*3+1=74=4 mod 10 (not valid)
Digits in odd places: 0+9+5+4+3+0=1 ... 1*3=3
Digits in even places (including the check digit): 0+2+2+5+1+1=1
Add them, and compare to 0: 3+1=4 This UPC code is not valid/correct.
Third way of doing it:
Add up for the first 11 digits: 0*3+0+9*3+2+5*3+2+4*3+5+3*3+1+0*3=73=3; so the check digit should be 0-3=7, which is not the check digit shown, so it is not valid.
C. 1-24431-65100-2
1*3+2+4*3+4+3*3+1+6*3+5+1*3+0+0*3+2=59=9 mod 10 (not valid)
Digits in odd places: 1+4+3+6+1+0=5 ... 5*3=5.....Watch out! I expect to see
5*3=5, even though you get the same number in the end!
Digits in even places (including the check digit): 2+4+1+5+0+2=4
Add them, and compare to 0: 5+4=9 This UPC code is not valid/correct.
D. 0-11676-10881-5
1*3+1+1*3+6+7*3+6+13+0+8*3+8+1*3+5=80=0 (valid)
Digits in odd places: 0+1+7+1+8+1=8 ... 8*3=4
Digits in even places (including the check digit): 1+6+6+0+8+5=6
Add them, and compare to 0: 4+6=0 This UPC code is valid/correct.