Complete a number that is missing its check digit
compute_luhn_digitGiven digits with the final check digit omitted, return the one that completes them. US healthcare NPIs and securities ISINs use the Luhn formula.
Use it to build valid test fixtures, to recover a last digit that was lost or illegible, or to check an implementation against a reference. To test a number you already have in full, use validate_identifier instead. Input must reduce to digits only once spaces and dashes are stripped; anything else is an error. Payment cards also use Luhn, and are deliberately out of scope here: do not pass card digits, partial or complete. This constructs a well-formed number and nothing more: it does not create, reserve or verify a real provider or security.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| partial | Yes | Digits excluding the final check digit. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| partial | Yes | The input digits, echoed back. | |
| checkDigit | Yes | The single digit that completes a Luhn-valid string. |