Hide

Problem A
CPR Number

Danish citizens have a unique personal identification number in the Danish Central Person Register, called the CPR number.

Each CPR number consists of ten digits. The first six digits represent the person’s day of birth. The following four digits are a sequence number.

Until $2007$, all Danish CPR numbers had to follow the modulo 11 rule: The CPR number $c_1$, $c_2$, $c_3$, $c_4$, $c_5$, $c_6$, $c_7$, $c_8$, $c_9$, $c_{10}$ must satisfy that

\[ 4\cdot c_1 + 3\cdot c_2 + 2\cdot c_3 + 7\cdot c_4 + 6\cdot c_5 + 5\cdot c_6 + 4\cdot c_7 + 3\cdot c_8 + 2\cdot c_9 + 1\cdot c_{10} \]

is divisible by $11$ without remainder.

A publication from the government agency CPR-Kontoret from 1 July 2008 explains the method using the CPR number 070761-4285 as an example.

Validating a number with check digit

The 10 integers

0

7

0

7

6

1

4

2

8

5

multiplied by

$\times $

$\times $

$\times $

$\times $

$\times $

$\times $

$\times $

$\times $

$\times $

$\times $

their corresponding values

4

3

2

7

6

5

4

3

2

1

yield

$0$

$+21$

$+0$

$+49$

$+36$

$+5$

$+16$

$+6$

$+16$

$+5$

which sums to $154$. Dividing $154$ by $11$ yields $14$ with no remainder.

Since $11$ divides $154$ without remainder, the test is passed. Otherwise the combination of 10 digits is wrong, or the CPR number does not have a check digit.

Input

A CPR number in the format ddmmyy-kkkk, i.e, $10$ digits separated by a single hyphen. It is guaranteed that ddmmyy is a valid date.

Output

“1” if the CPR Number is valid accoring to the modulo $11$ test, else “0”.

Sample Input 1 Sample Output 1
070761-4285
1
Sample Input 2 Sample Output 2
051002-4321
0
Sample Input 3 Sample Output 3
310111-0469
1

Please log in to submit a solution to this problem

Log in