I joined the RAF as a Boy Entrant in 1959, demobbed in 1973. In the mid 1960s a letter was added to my RAF service number. Here is the algorithm that was used to calculate the letter:
Multiply the first digit by 8
second by 17
third by 4
forth by 16
fifth by 2
sixth by 13
seventh by 5
Add these up to produce answer A
Divide A by 23
Chop all the decimal places then multiply by 23. The result is answer B.
Subtract B from A to produce answer C which is a letter of the alphabet where Zero = A, 1 = B, 2 = C etc. But omit "O" and "I" to avoid confusion with "0" and "1".