LH PK-Number Control Code
Enter Your Personnel No.
Your Control-Letter will be computed.
E. g., my personnel number is 5111 and the Letter is 'D'.
The control-codes 'ABCDEFGHIK' are mapped to the numbers 0-9
in the way:
A=1, B=2, C=3, D=4, E=5, F=6, G=7, H=8, I=9, K=0.
The control equation Lufthansa uses is the 137-code:
a1 + 3*a2 + 7*a3 + a4 + 3*a5 + 7*a6 + a7 = 0 (modulo 10)
So my number 005111 D has (a1,...,a7)=(0,0,5,1,1,1,4)
which satisfies the equation.
When I joined the company, I calculated the equation from
the numbers of some collegues assuming a modulo 10 code.
As I saw the 137 pattern I knew I was correct. I was worried
about the number of one person, as it does not fit. But
it turns out that his number (equal his account) had been
typed in wrong.
J. A. Gallian,
Error Detection Methods,
ACM Computing Surveys, 28:3 (Sept. 1996) 504-517
J. A. Gallian, ST. Winters,
Modular Arithmetic in the Marketplace,
American Mathematical Monthly 95:6 (1988) 548-551
Mit Sicherheit, Pruefziffernverfahren auf Modulo-Basis,
c't (Juli 1996) Heft 7, Seite 264
W. Press, S. Teukolsky, W. Vetterling, B. Flannery,
Numerical Recipes in C,
The Art of Scientific Computing (Second Edition)
http://nr.harvard.edu/nr/bookc.html (Online Version)
20.3 Cyclic Redundancy and Other Checksums 896-903
VIEWEG VERLAG, 1991, ISBN: 3-528-06419-6
How looks such a simple equation in your favorit script language?
I tried some. The filter variants are reading lines from stdin and
assume that the first word is a pk-number.