# Dawn of the planet of Apes

Its dawn of the planet of apes and somehow an ape got into an armed spaceship. He is trying to launch a missile by clicking random buttons on the board.

There are three buttons on the board: $$(R)Red$$, $$(G)Green$$ and $$(B)Blue$$. A missile will be launched if the ape presses Red, Green, Blue consecutively in sequence. What is the expected number of missiles that he will launch if in total he pressed $$1000$$ buttons while in the spaceship?

Example:

Suppose he pressed the following buttons in sequence: $$R, G, B, B, G, R, G, B, B$$, then $$2$$ missiles will be launched.

Assumptions:

1. Assume the ape is not capable of learning.
2. He presses the buttons equally likely
3. He doesn't break the buttons while pressing.
×