# Moden Infinite Monkey's standard deviation

1. Jan 29, 2010

### Mr Peanut

Given an imaginary, mechanical chimpanzee that never wears out nor sleeps nor relents. Who is compelled to type constantly through eternity into an endless text file using a US standard keyboard... as fast as he can. That this monkey knows simply that he must hit only character keys and only one at a time. He has the additional random option of holding down dead keys (shift key & Alt key). He has no other faculties. He is purely random in nature. His access to each of the character keys is exactly equal except that striking the windows key, menu key, esc key, and control key are infinitely unlikely.
Given that he is limited by the design specifications of the best keyboard... made to support a typist that is twice as fast as the world record holder for typing (37,500 keys/50 min = 12.5 keys/sec). This design limit is 25 characters per second.
Given that he confines his speed to exactly the design limit and types 25 characters per second.
Given that the Guttenberg Project’s flat text file for the King James Bible (GPKJB) has 4,245, 026 characters in a specific sequence in the file.

then

1) The keyboard allows any one of 256 characters to be typed per key press (ASCII 0 – 255). The probability of hitting a given key is 1/256 = ~0.004

2) The average number of keys that must be struck before he duplicates the file is:
(0.004)^4,245,026 = 5.6 X 10^36

What's the standard deviation of this average?

2. Jan 31, 2010

### torquil

Typo? Or does the a^b not mean a to the power of b in this case?

3. Jan 31, 2010

### Mr Peanut

To the power of.

Some stuff in the premises will seem superfluous. For example, the typing rate. The reason it's there is; the next part of the idea is to determine expectations about how long it should take, then how long it will take multiple monkeys.

Thanks

4. Jan 31, 2010

### willem2

(0.004)^4245026 is about $${10}^{-{10}^7}$$

I think the probability distribution for the first occurrance of the king James bible is very close
to a geometric distribution P(X=k) = p (1-p)^(k-1) for k >=1 with

$$p = {10}^{-{10}^7}$$

both the mean and the standard deviation are equal to 1/p

This is only approximate because:

P(X<4,245,026) is 0 because you can't have a bible if you do not have at least 4,245,026 characters.
We can ignore this because 4,245,026 * p is so small compared to 1/p

If te last 4,245,026 characters were the King James bible, the next character couldn't be the end of the king james bible (unless the bible is aaaaa..... ..........aaaaaaa) so if the last 4,245,026 characters weren't the King James bible, the probability of that it's finished with the next character is slightly higher. This is also unimportant because it increases the probability that the last character finishes the KJB from p to 1/((1/p)-256)) about p + 256 p^2
(256 outcomes for the last 4,245,026c characters are no longer possible because the KJB didn't finish 1 character ago)
This can also be ignored because 256p^2 is so small compared to p

5. Jan 31, 2010

### Mr Peanut

Thanks,

So, it looks like relative error= (256p^2)/p

Does this error function have this form for any size character string I try to match? That is; does it apply to a short string like " banana "?

6. Feb 1, 2010

### Anonymous217

You'd need a lot more "givens" than just that if you want to provide the entire premise.