zoukankan      html  css  js  c++  java
  • The Singapore NRIC Check Digit

    The Singapore NRIC number is made up of 7 digits and a letter behind. This letter is calculated from the first 7 digits using the modulus eleven method, similar to the method used for calculating the check digit of the ISBN Code. 

    The steps involved to obtain the check digit is

    1. Multiply each digit in the NRIC number by its weight.
    2. Add together the above products.
    3. Divide the resulting sum by 11.
    4. Subtract the remainder from 11 to give the check digit.
    5. Check the check digit against the table to obtain the alphabet.

    The following table shows the weight for the NRIC number in Singapore :

    2

    7

    6

    5

    4

    3

    2

    The following table is used to change the check digit into the corresponding alphabet.

    Check Digit

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    Alphabet

    A

    B

    C

    D

    E

    F

    G

    H

    I

    Z

    J

     

    This system is used to prevent illegal workers from entering Singapore with a fake passport using a fake NRIC number.

     

    A person has a NRIC number S1234567A

     

    To find out if the NRIC number is valid, we need to use the method above.

     

    2(weight)*1(NRIC number) + 7(weight)*2(NRIC number) + 6(weight)*3 + 5*4 + 4*5 + 3*6 + 2*7 = 106

     

    106/11 = 9 r 7

     

    11-7 = 4

     

    Using the table above, if the check digit is 4, then the alphabet at the end of the NRIC number should be D. So, we can conclude that this NRIC number is invalid.

  • 相关阅读:
    Node 之http模块
    Node 之 模块加载原理与加载方式
    Node 之NPM介绍
    Node.js的特点
    ECMAScript 6 简介
    Node 之URL模块
    用户模块 之 根据条件查询用户
    用户模块 之 完成用户列表的分页显示
    用户模块 之 完成查询所有帖子、完成查询所有回复以及点赞
    用户模块 之 完成查询所有用户
  • 原文地址:https://www.cnblogs.com/lei1016cn/p/3419169.html
Copyright © 2011-2022 走看看