Do You Understand the X at the End of the ID Card Number?

Author:kedoSource:Tadpole StaveRelease time:2022-01-20

Don't you think this algorithm wonderful?

As we all know, 2020 is a magical year...

For example, for a little girl born on February 2, 2020, her ID card number only makes up of two digits: 0 and 2.  

164266793587100_html_11ebc7f4b85a665

First of all, let me show you this ID card number that looks like kidding: 220202202002020022.

Well, isn't that amazing?

Speaking of ID card numbers, there are many people whose ID card numbers end with an X.

Opinions vary on this mysterious letter X. One child even thought that the X in his ID card number meant that he would be executed by shooting when he grew up, so he drew up an escape plan...  

So what does the X at the end of the ID card number stand for?

Meaning of the 18 Digits in ID Card Number

Our ID card number is made up of 18 digits, the first six digits are our address codes, which represent our place of birth.

The first and second digits are the codes of provincial administrative regions, and so on, the third and fourth digits are municipal administrative areas, and the fifth and sixth digits are codes of county-level administrative districts.

The address codes of all regions/ areas/ districts are available online. For example, in the case of the little girl we mentioned above, the first six digits of her ID card number are 220202, which means that her place of birth is Changyi District, Jilin City, Jilin Province. Changyi District here is equivalent to a county-level administrative unit. 

As a matter of fact, regarding the administrative units in China, as long as we put them under tight scrutiny, we shall find that there are not only provinces, cities and counties, but also direct-controlled municipalities, autonomous regions, county-level administrative units directly under the jurisdiction of provinces, municipal districts, autonomous prefectures, banners and so on.

As for the relationship among these administrative units, it is beyond description with several words. Interested guys can study by yourselves. 

Ok, let's go back to ID card number! The first six digits are address codes, the next eight digits are probably familiar to everyone, that is, our date of birth, expressed by year, month and day.

Then the next three digits are sequential codes, that is to say, babies born on the same day, in the same month, the same year and the same region are ranked respectively. This is how sequential codes are formed. 

What's more, sequential codes follow a particularly interesting rule, that is, odd for males and even for females. If the sequential code is odd, then the kid is a boy. If the sequential code is even, then the kid is a girl. So we can judge a person's gender simply by his/her ID card number.

Ultimately, we come to the last mysterious digit! This digit is called check code.

The check code is calculated by a systematic calculation method. If the resulting number is any digit from 0 to 9, X will not appear. If the number is 10, it shall be replaced by the Roman numeral X.

This is because if the final digit of ID card number is 10, the length of the original ID card number will increase by one digit, which doesn't conform to national standards. Neither does it constitute a legitimate ID card for Chinese residents.

The Calculation Method of the Mysterious X

Having seen this, you must be aware of the meaning of the X at the end of ID card number. It is nothing particular, and has no special meaning, but simply a substitute letter for the digit 10.

The last digit of the ID card number is also called check code. As the name suggests, a check code is to check whether an ID card number is correct. So the system can identify it when you fabricate an ID card number at will, or when you input an incorrect ID card number!

Then what is the calculation method of check code? Is that complicated?

Complicated? Well, the calculation method is indeed a bit complicated, but those who have learned mathematics in junior high school can calculate it by themselves with care!

To begin with, let me show you the general calculation formula:

164266793587100_html_16d38a47e51cc539

Having seeing this, many people may get a nasty shock.

Haha, no worry, let's look at what the letters and symbols in the formula stand for first.

Again, by taking the little girl in Jilin Province as an example, her ID card number is 220202202002022.

ai: stands for the number that ranks from right to left among the 18 digits of the ID card number. For example, a1 represents the first digit from right to left (i.e., 2) and a3 represents the third digit from right to left (i.e., 0). What we need to solve here is the check code a1.

wi: The weighting factor, that is, coefficient. The coefficient of the 18 digits of the ID card number is constant and the calculation formula is:

164266793587100_html_f392b265614585a3

mod. This mathematical symbol is called “modulo”, which represents the remainder after “being divided by” the number that follows. So mod 11 is the remainder after being divided by 11.

Through the calculation formula of weighting factor, ultimately the coefficients of the first 18 digits of ID card number can be figured out as: 7-9-10-5-8-4-2-1-6-3-7-9-10-5-8-4-2-1 from left to right.

It’s pretty clear when a table is made: 

164266793587100_html_d3904e9754a89f3e

Next, let’s look at the following formula:

164266793587100_html_46487eded49a2b49

This summation symbol is quite common in mathematics, and you must be familiar with it, aren't you? It means that the 2nd digit (a2) to the 18th digit (a18), i.e., the first 17 digits of the ID card number from left to right are multiplied by the coefficient and then summed up.

For the ID card number 220202202002020022 mentioned above, the value calculated according to this formula is 98 (you can verify it yourself ).

After that, we divide the number obtained by summation (98) by 11 to get the remainder (after 98 is divided by 11, the remainder is 10). And then after this remainder is subtracted from 12, the difference (2-10=2) is divided by 11 again to get the remainder (after 2 is divided by 11, the remainder is 2), and this remainder (2 in our case) is exactly the check code!

Since during the calculation, the dividend is 11, there are 11 possible remainders (0-10), if the remainder ranges from 0 to 9, the final digit of the ID card number is the number itself. If the remainder is 10, X will be used instead!

The check code we get from the calculation formula is consistent with the last digit of the ID card number mentioned above. It seems that this ID card number is unproblematic~

Don't you think this algorithm wonderful?

Finally, let me assign homework to those who long for more. If the ID card number of a handsome body born in the Republic of China was 53010219200508011X, was this ID card number correct?

Let's check whether this ID card number conforms to the current calculation rule.

Reviewing Expert:Zhu Guangsi,Member of Beijing Science Writers' Association.