Validate and learn how the validation works for the Canadian Social Insurance Number.
The Social Insurance Number (SIN) number originally created by the government of Canada to track and administer CPP, which was later taken over by the Canadian Revenue Agency (CRA) as a way to track an individuals reporting of taxes.
The first digit of a SIN usually identifies the province in which it was registered, as listed below. However, the government has found it necessary in the past to supply certain regions with SIN numbers assigned to other regions.
Interactive example of how we did the validation above using Luhn formula.
As an example since you have not tried to validate a SIN Number yet we will use 087727814 as the test number to demonstrate how to use Luhn's formula.
The check digit (x) is obtained by computing the sum of digits then computing 9 times that value modulo 10 (so that is: (36 * 9 mod 10)).
In summary: