PESEL is an eleven-digit personal identification number used in Poland, which encodes a given person’s birth date and gender, and contains a control digit meant to catch most of everyday typos.
PESEL’s structure is
BBBBBBXXXXC – the first six digits (
the birth date, the next four digits (
XXXX) are person-specific (with last
digit’s parity denoting gender) and the last digit (
C) is the control digit.
For the purpose of these examples, let’s assume that we’re only interested in
people born in the 20^th century; in their case the first six digits directly
encode the birth date in the
Gender (limited to female/male distinction) is defined by the parity of the tenth digit: even → female, odd → male.
The last digit of PESEL is computed in a way that catches most of everyday typos: the sum of PESEL’s digits multiplied by certain weights must be divisible by ten.
The weights of the elevent digits are 1, 3, 7, 9, 1, 3, 7, 9, 1, 3, 1,
respecively; thus, for an
ABCDEFGHIJK number the following must hold:
(A * 1 + B * 3 + C * 7 + D * 9 + E * 1 + F * 3 + G * 7 + H * 9 + I * 1 + J * 3 + K * 1) % 10 == 0