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.



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.

Torsten Sillke