0

So recently, I've been working on my IB Math IA about Infinite Monkey Theorem, and in my search to try and figure out some math principles that could potentially lead me to be able to derive an equation that could find the expected (mean) number of keystrokes that it would take $\text{x}$ amount of monkeys typing a string $\text{n}$ characters long, I found this forum post where someone makes the following function, assuming a string of length 18, an alphabet with 28 characters, and $n=28^{18}$.

$$18p\Sigma_{k=1}^nk \text{ seconds }\\\rightarrow 18p\frac{n(n+1)}{2} \text{ seconds }\\\rightarrow 18\frac{(n+1)}{2} \text{ seconds}$$

With this, I want to have some direction as to the following two questions.

  1. What principles do they use to create the original function? I want to make my own derivation of the equation so I want to understand how they went about solving the problem.
    • Original function being $18p\Sigma_{k=1}^nk \text{ seconds }$
  2. How could I add a variable to find the number of keystrokes it might take for multiple monkeys to type the string? I want the equation to be a bit more complex, as it is for my Math IA and I feel that just using that equation doesn't have enough mathematical concepts to warrant a whole HL Math IA.
  • You want to add that your (purported) formula is for a single monkey to type out a string of length $18$ with an alphabet with $28$ characters, and $n=28^{18}$ (at least that's what it looks like in the linked page), – jlammy Feb 06 '21 at 01:03
  • The formula isn't quite right, though it's in the right ballpark. The issue is that the expected time to type out a string depends on properties of the string other than the length. For example, if you restrict yourself to just the $26$ letters, the expected time to type out "ABRACADABRA" is $26^{11}+26^4+26$ (see e.g. here), but the expected time to type out "AAAAAAAAAAA" (also 11 chars) is $26^{11}+26^{10}+\dots+26$ (see a similar problem here). – jlammy Feb 06 '21 at 01:17
  • @jlammy First of all, thank you for pointing out the mistake in the post! I've edited it to make sure that it's more clear. Secondly, thank you for pointing me to these resources. There seem to be a multitude of different ways to go about this problem, and my Math IA is seeking to try and find a catch-all function after plugging in a string. I was wondering if there was a way to find that with a Calc 1 level understanding of math, or if I had to narrow my scope with the equation. I would be perfectly fine removing the whole second part of the research if it meant something more in my scope! – Nathaniel Zerai Feb 06 '21 at 01:41
  • One more point that you should clarify -- I assume you're looking for a function for the expected time (i.e. average time) for a monkey to type out a string. There would certainly be no deterministic formula, e.g. if your target string is "hello" it's possible the monkey gets really lucky and types it out straight away, but in general you expect you'll have to wait a while. – jlammy Feb 06 '21 at 01:53
  • To find the expected time to type out a general string, you can adapt either (a) the generating function solution in the first link I gave or (b) the martingale solution I gave in the second link. Both are probably well beyond high school mathematics. – jlammy Feb 06 '21 at 01:55
  • @jlammy Average time is what I'm looking for yeah, otherwise I don't think I would have been able to get as far as I have with my IA. :) I actually wrote a program that generated a ton of data on finding single and double character strings, like "I" and "hi" to have an average amount of data. I will make sure to fix that too! – Nathaniel Zerai Feb 06 '21 at 01:58
  • Some interesting questions that you might like to think about, which don't require you to derive an explicit formula (a) It turns out that for a given string length $n$, the string that maximises the expected time is the one with all chars the same, e.g. "aaaaa" (your data should support this claim). Can you give a reason why you might expect this? (b) What is the expected time to type a given character e.g. "a"? What about strings of length $2$? Length $3$? You should be able to find an exact answer for these cases (though it isn't easy!). – jlammy Feb 06 '21 at 02:14

0 Answers0