Luhn algorithm has been developed to decrease probability of entering wrong identification numbers. The last digit is a checksum of the other digits. It is being used in credit card numbers, IMEI numbers, social security numbers, SIM card numbers and so on. This algorithm was developed by Hans Peter Luhn.
How to calculate the check digit?
If the number already contains the check digit, remove that digit. The check digit is the last digit.
Start from the rightmost digit. Moving left, double the value of every second digit (including the rightmost digit).
Sum up the digits of the resulting value in each position (using the original value where a digit did not get doubled in the previous step).