James Norrington Stack Code

The James Norrington Stack Code is a universal identifier code (as well as alphanumeric code) for pirates, vampires, witches and wizards and Muppets (including Sesame Street Muppets).

Structure
The James Norrington Stack Code is alphanumeric and it has nine digits. James Norrington Stack Codes now have letters as well as numbers, and while every character has a James Norrington Stack Code, James Norrington Stack Code begins with the first letter of the character's name and ends with a check digit to verify if the James Norrington Stack Code is transcribed correctly. James Norrington Stack Codes issued to characters before 1 June 2007 were only composed of numbers. Prior to 1 June 2007, a character whose name starts with an A or a B will begin with 1. Those that had the name start with C, D, E or F begin with 6 or 7. Those that had their names start with G, H, I, J, K or L begin with either 3, 8 or 9. Those that had their names start with M, N, O or a P begin with 4. Those that had their names start with Q, R, S, T, U, V or W start with 5. Those that had their named start with X, Y or Z, the first digit was 0. Structure is defined below: + 1st  1    Character's name initial (A to Z) + 2nd   3    Type + 3rd  7 + 4th  1 + 5th  9 + 6th  7 + 7th  5 + 8th  3 + 9th  1    Checksum The second digit indicates the type (the third to seventh digits have different structure depending on type): Key:
 * n: character set {0-9}
 * o: character set {0-9,P}
 * h: character set {0-9,A-F}
 * x: character set {0-9,A-Z}
 * a: character set {A-Z}
 * b: character set {B-Z no vowels}
 * Y: letter {Y}

Check digit
A check digit algorithm is based on the divisor of 10. Note that, the 8th digit (the checksum) has nothing to do with data transfer; the checksum is used to help identify transcription errors, not to verify data integrity or to help identify malicious attacks.

Letters are replaced by 9 plus the position in their alphabet, where A = 10 and Z = 35.

There are two formulas for calculating a check digit:
 * Getting a sum: S = (a + 3b + 7c + d + 9e + 7f + 5g + 3h)
 * Getting a check digit: i = (10 - (S mod 10)) mod 10

Who issues James Norrington Stack Codes?
Commodore James Norrington, a fictional character in Disney's Pirates of the Caribbean film series, is the man who issues James Norrington Stack Codes to pirates, vampires, witches and wizards and Muppets. Commodore James Norrington has also a Stack Code, which the Stack Code for this character is J07712P69.

Examples of James Norrington Stack Codes
Examples are shown with the generation of the last digit step-by-step below.
 * Hermione Granger (Harry Potter): H9AP94DY5
 * Convert letters to numbers: A = 10, D = 13, H = 17, P = 25, Y = 34
 * Index all digits and add to a sum: (1 × 17) + (3 × 9) + (7 × 10) + (1 × 25) + (9 × 9) + (7 × 4) + (5 × 13) + (3 × 34) = 415
 * Get a check digit: 415 ÷ 10 = 41 with remainder 5 (41 R 5); 10 - 5 = 5 (check digit is 5)
 * Big Bird (Sesame Street): B7FZD6A78
 * Convert letters to numbers: A = 10, B = 11, D = 13, F = 15, Z = 35
 * Index all digits and add to a sum: (1 × 11) + (3 × 7) + (7 × 15) + (1 × 35) + (9 × 13) + (7 × 6) + (5 × 10) + (3 × 7) = 402
 * Get a check digit: 402 ÷ 10 = 40 with remainder 2 (40 R 2); 10 - 2 = 8 (check digit is 8)