Number of possible keys for a substitution cipher

687 Views Asked by At

I'm currently reading "Cryptonomicon" by Neal Stephenson. There is a passage* where one of the main characters is confronted with the following encrypted message:

19 17 17 19 14 20 23 18 19 8 12 16 19 8 3

21 8 25 18 14 18 6 3 18 8 15 18 22 18 11

He recognizes that a substitution cipher is being used and that only 16 letters are substituted:

Assuming each of those sixteen represents one and only one letter of the alphabet, this message has (Lawrence reckons in his head) $111136315345735680000$ possible meanings.

So far, this makes sense to me because:

$$111136315345735680000 = {26 \choose 16} \cdot 16!$$

The protagonist then substitutes the letter "E" into the message:

19 17 17 19 14 20 23 E 19 8 12 16 19 8 3

21 8 25 E 14 E 6 3 E 8 15 E 22 E 11

which only has $10103301395066880000$ possible meanings

where $10103301395066880000 = {26 \choose 15} \cdot 15!$

Shouldn't the number of possible keys/meanings be $$4274473667143680000 = {25 \choose 15} \cdot 15!$$

since one number has already been fixed?

(I tried this with a small example.)

*There is an excerpt which contains this passage.

1

There are 1 best solutions below

0
On BEST ANSWER

So, there are $16$ unique codes $\{3,6,8,11,12,14,15,16,17,18,19,20,21,22,23,25\}$ and 26 letters in the English alphabet. We can choose 16 letters out of 26 in $\binom{26}{16}$ different ways ignoring the order. But order matters, so the final answer is $\binom{26}{16} \cdot 16!$.

Now, by mapping $\color{blue}{E \Leftrightarrow 18}$, we are left with $15$ codes and $25$ letters, thus $\binom{25}{15} \cdot 15!$