Skip to content

Example scripts that validate a NHS number written in various langauges

Notifications You must be signed in to change notification settings

miketrebilcock/NHSNumber-Validation

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

NHS Number Validation Examples

The NHS Number is 10 digits long. The last digit is the "Check Number" or "Check Digit ". This is used to validate the full NHS Number. A calculation is made on the first 9 digits and its sum is compared against the check digit to see if the NHS Number is correct.

The calculation

  1. Multiply each of the first nine digits by a defined weight. The weight is shown below:

1 - 10

2 - 9

3 - 8

4 - 7

5 - 6

6 - 5

7 - 4

8 - 3

9 - 2

For example if the 2nd digit is 3 then its 3 x 8. If fourth digit is 7 then its 7 x 4

  1. Get the sum of the 9 multiplications.

  2. Divide this sum by 11 and get the remainder

  3. Subtract 11 from the remainder to get the total

  4. If the total is 11 then the identifier is 0, otherwise the identifier is the total

  5. If the identifier is 10 then the NHS Number is wrong

  6. If the identifier equals the check number then the NHS number is correct

About

Example scripts that validate a NHS number written in various langauges

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 54.2%
  • PHP 45.8%