The national identity document (DNI) in Spain consists of an 8-digit number and a letter. The DNI letter is obtained from the numbers as described in the following steps
- Calculate the remainder of dividing the ID number by 23
- The number obtained is between 0 and 22. Select the letter associated with that number in the following table:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
T | R | W | A | G | M | Y | F | P | D | X | B | N | J | Z | S | Q | V | H | L | C | K | E |
Example: Here you can see the ID of a friend of ours:
- Name: TUX
- Surname: TORVALDS
- Second surname: GNU
- DNI: 31415927-C
The ID number is 31415927 and the remainder of dividing by 23 is 20: 31415927 = 1365909 x 23 + 20; therefore the letter that corresponds to it according to the table is "C"
To run: npm run start [-- number]