Thursday, November 12, 2009

Checking validity of Singapore IC Number

It is based on modulus 11 using the 7 digits in the NRIC number. Using Di to denote the digit where i is the placing in the 7 digits, we have

x = 2 * D1 + 7 * D2 + 6 * D3 + 5 * D4 + 4 * D5 + 3 * D6 + 2 * D7

To get y, which is the check digit, we have

y = 11 - ( x mod 11 )

Where y is represented by: 1 = A, 2 = B, 3 = C, 4 = D, 5 = E, 6 = F, 7 = G, 8 = H, 9 = I, 10 = Z and 11 = J

The above information is obtained from one of the NUS lab exercise.

No comments: