Luhn
Credit Card numbers are (most times) 13 to 16 digit numbers
which are protected by a special numerical check, called Luhn check.
Each digit is multiplied by the alternating factors 2 and 1 (last digit is always multiplied by 1).
Of each calculation result, the digits of the result are summed together.
Then, these sums are totalized.
Finally, to be a valid Credit Card number, the total must be divisible by 10.
Example (Credit Card number: 1234 5678 7654 3210):
| 1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
7 |
|
6 |
|
5 |
|
4 |
|
3 |
|
2 |
|
1 |
|
0 |
| * |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
* |
| 2 |
1 |
2 |
1 |
2 |
1 |
2 |
1 |
2 |
1 |
2 |
1 |
2 |
1 |
2 |
1 |
| = |
= |
= |
= |
= |
= |
= |
= |
= |
= |
= |
= |
= |
= |
= |
= |
| 2 |
2 |
6 |
4 |
10 |
6 |
14 |
8 |
14 |
6 |
10 |
4 |
6 |
2 |
2 |
0 |
| 2 |
+ |
2 |
+ |
6 |
+ |
4 |
+ |
(1+0) |
+ |
6 |
+ |
(1+4) |
+ |
8 |
+ |
(1+4) |
+ |
6 |
+ |
(1+0) |
+ |
4 |
+ |
6 |
+ |
2 |
+ |
2 |
+ |
0 |
| 2 |
+ |
2 |
+ |
6 |
+ |
4 |
+ |
1 |
+ |
6 |
+ |
5 |
+ |
8 |
+ |
5 |
+ |
6 |
+ |
1 |
+ |
4 |
+ |
6 |
+ |
2 |
+ |
2 |
+ |
0 |
= |
60 |
= |
N*10 |
2000-02-15