1. Multiply the 17 digits of the previous ID card number by different coefficients. The coefficients from the first digit to the second digit are: 7-9-10-5-8-4-2-1-6-3-7-9-10-5-8-4-2.
2. Add the result of multiplying the 17-digit number and the coefficient.
3. How much is the remainder can be seen by adding and dividing by 11?
4. The remainder can only contain the 11 numbers 0-1-2-3-4-5-6-7-8-9-10. The numbers of the last ID card are 1-0-x-9-8-7-6-5-4-3-2.
5. If the remainder is 2, the X of the Roman numerals will appear on the 18th digits of the ID card. If the remainder is 10, the last digit of the ID card is 2.
For example, the ID number of a male is 34052419800101001x. Let's see if this ID card is a valid ID card.
First, we get the product of the first 17 bits and the product is 189. Then we divide 189 by 11 and the result is 17 + 2/11, that is, the remaining number is 2. Finally, the corresponding rule shows that the number of remainder 2 is X. Therefore, it can be determined that this is a qualified ID card number.
VaR arr = [,] var arr2 = '201712119880915005x '. split (''); Total = 0; For (VAR I = 0; I <arr. length; I ++) {total + = ~~ Arr [I] * ~~ Arr2 [I]} console. log (Total % 11) console. log ([, 'x',] [Total % 11]) // The value of the last bit
Calculation Method of ID card 18th-bit (Verification Code)