# Probability of Monkey typing keyboard

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.

-
Have you searched for ...ehm... monkey? –  user13838 Nov 2 '11 at 16:55
+1 for making me smile –  dungeon Hunter Nov 2 '11 at 16:58
Does xxbonbonbonbonxx count as two or three appearances? –  Henning Makholm Nov 2 '11 at 16:59
If xxbonbonbonbonxx counts for three, the answer is correct provided you replace one million by one million minus five. –  Did Nov 2 '11 at 17:39
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. –  Did Nov 3 '11 at 17:25

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.

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6666932702064514, "perplexity": 2807.06018489064}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-06/segments/1422115869320.77/warc/CC-MAIN-20150124161109-00053-ip-10-180-212-252.ec2.internal.warc.gz"}