FA-72824 / Check-digit algorithms / Member archive
NIE prefix letter is dropped instead of mapped · case 04
Y- and Z-series foreigner numbers get the wrong control letter (X happens to work).
Case contract
Spanish DNI/NIE control letter: input upper-cased, hyphens removed, then nine characters: eight digits (or X/Y/Z followed by seven digits, the prefix standing for 0/1/2) and a letter (else "malformed"). The letter is "TRWAGMYFPDXBNJZSQVHLCKE"[number mod 23]. Return [expected letter, match].
Why this case matters
Tax and KYC forms validate the control letter of Spanish national and foreigner identity numbers.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression ["Z1234567R"] | ["L", false] | ["R", true] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗