6
$\begingroup$

A monkey types at a 26-letter keyboard with one key corresponding to each of the lower-case English letters. Each keystroke is chosen independently and uniformly at random from the 26 possibilities. If the monkey types 1 million letters, what is the expected number of times the sequence "bonbon" appears?

P.S bonbonbon counts as two appearances.

My approach is

Let the indicator $I_B$ be the event that "bonbon" appears, then $P(I_B) = 1/26^6$

Then $E(X) = E(I_{B_1} + I_{B_2} + \dotsb + I_{B_\text{1 million}}) = 1\text{ million} \times 1/26^6$

Is my approach right? Somehow I feel I have done something wrong here.

  • 0
    Have you searched for ...ehm... [monkey](http://math.stackexchange.com/questions/17152/)?2011-11-02
  • 2
    Does `xxbonbonbonbonxx` count as two or three appearances?2011-11-02
  • 0
    bonbonbon counts as two appearances2011-11-02
  • 6
    If xxbonbonbonbonxx counts for three, the answer is correct provided you replace one million by one million minus five.2011-11-02
  • 0
    @percusse, the link corresponds to the title of this post, not to its content.2011-11-02
  • 0
    @DidierPiau It's a joke!2011-11-02
  • 0
    Indicator works fine, but one should be precise about the definition. $I_n=1$ if an initial "b" of "bonbon" appears in position $n$.2011-11-02
  • 0
    You're right. Linearity of expectation is a wonderful thing, particularly since it doesn't depend on the events being independent.2011-11-02
  • 0
    @DidierPiau, why minus five?2011-11-03
  • 1
    Because the word `bonbon` has length six hence it cannot begin at position 999,996 or later on and be completely written at position 1,000,000.2011-11-03
  • 0
    @DidierPiau that makes a lot of sense. Why I didn't think of that. Thanks for the help2011-11-03
  • 0
    @DidierPiau, you should write this up as an answer.2011-11-25

1 Answers 1

5

If xxbonbonbonbonxx counts for three, the answer is correct provided one replaces one million by one million minus five. Why minus five? Because the word bonbon has length six hence it cannot begin at position 999,996 or later on and be completely written at position 1,000,000.