9

Toward the beginning of Neal Stephenson's Cryptonomicon, Avi gives Randy two strings of sixteen supposedly random hexadecimal numbers as encryption keys:

AF  10  06  E9  99  BA  11  07  64  C1  89  E3  40  8C  72  55

67  81  A4  AE  FF  40  25  9B  43  0E  29  8D  56  60  E3  2F

If you change the hexadecimals to decimals and change the decimals to letters, modulo 25 without J, like Lawrence does with his one-time-pads later in the book, you get:

z   k   f   h   c   l   r   g   z   s   m   b   o   p   o   k

c   d   o   y   m   o   m   e   r   o   q   q   l   v   b   w

The first sequence contains two Os and the second contains three Os. The probability of randomly picking at least five Os out of twenty-five letters given thirty-two picks is less than 1%, which makes it seem like the numbers are not actually random.

Additionally, there are six prime numbers in each sequence:

E9  11  07  C1  89  E3

67  25  43  29  E3  2F

(all primes in base sixteen)

What does this mean?

10
  • 4
    Before people start casting close votes, I shall say that this is not off-topic, as it relates to an in-universe event, possibly explainable with in-universe logic or word of god. Feb 28, 2017 at 20:54
  • 4
    So... Stephenson used a shoddy psuedorandom generator? Security researchers creating encryption algorithms have made similar mistakes, let alone writers... and overly large primes are the basis of modern encryption, so... he went for and got some primes? shrug While this is on-topic, it seems more like you want coding experts rather than fiction experts.
    – Radhil
    Feb 28, 2017 at 20:56
  • 1
    For those feeling the need to check, strings are in "Novus Ordo Seclorum" chapter, one near the beginning, one near the end, pages 29 and 37 in the paperbook.
    – gowenfawr
    Feb 28, 2017 at 21:01
  • 1
    @Gallifreyan out-of-universe, it might also be an "easter egg" or hidden joke (this is the author who waited until 5/19/15 to release Seveneves). And as such, also potentially on-topic.
    – gowenfawr
    Feb 28, 2017 at 21:10
  • 2
    One point to consider is that it would be a coincidence no matter the letter that gets repeated 5 times. I mean, the probability of 5 Os maybe less than 1%, but if you identify as "suspicious" any chain with 5 repeated letters, then you get that the probability of a "suspicious" chain is "25 * [probability of a given letter appearing 5 times]". And of course, the fact that there are repetitions is not proof at all that the numbers are random, with a sample so small. Obligatory Dilbert reference, Obligatory XKCD reference
    – SJuan76
    Feb 28, 2017 at 22:31

1 Answer 1

11

I admit that I don't have the math to calculate the odds precisely, but we should start out by observing that the letter "O" is not particularly interesting here. What we're concerned with is the chance of some letter being repeated 5 times in a string of 32 draws. What are the odds of that not happening? I suspect they're not very good.

Let's consider a slightly simpler case: what are the odds of drawing 25 tiles from a 25-tile set, with replacement, and getting each tile represented? Clearly it's 24!/(25^25), right? The first tile is free, we have a 1/1 chance of getting a unique item. Then we have 24/25 odds of a unique second tile, times 23/25 odds for a unique third tile, and so on down to 1/25 for the last. So we're looking at 25/25 * 24/25 * ... * 2/25 * 1/25, which is a very small number.

Someone with a better training in probability than I've got will have to extend this to the problem of drawing 32 with not more than 5 repeats, but the following little bit of python consistently finds ~.17 percent chance of getting 5 or more repeats when drawing 32 times with replacement from a bag of 25.

>>> def trials(n=10000):
...   count = 0
...   for i in range(n):
...     c = Counter([randint(1,26) for _ in range (32)])
...     if 5 <= max(c.values()):
...       count += 1
...   return count/float(n)
... 

So a little less than 1/5, which is not such bad odds. So I think the premise of the question, that the repetition of some letter 5 times in a sequence of 32 draws with replacement from a set of 25 is highly unlikely, is incorrect, and this is not an anomaly.

1
  • I presume by "~.17 percent chance" you actually mean 0.17 out of 1, which translates to 17 percent, and matches your later "1/5". 0.17 percent would be 1 in 500.
    – IMSoP
    Jan 11, 2022 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.