Artificial intelligent assistant

Expected value of key presses I came across this extremely strange problem that revolves around a piano. I'm not sure how to go about solving it because of the peculiarity. There are 9 notes on a mini piano, numbered from 1 to 9. My pet zebra (which happens to be black and white like a piano) sits on the bench and starts randomly pressing a note every second. However, this piano is a special computer that prints the number that is played from hitting the notes. If I leave my pet zebra alone for $N$ seconds, what is the expected value of the number he generates when I walk back in to stop him.

Don't let the zebra throw you off!

Let $$X_i = \begin{cases}1, & p = \frac 1 9 \\\ 2, & p = \frac 1 9 \\\ \vdots \\\ 9, & p = \frac 1 9\end{cases}$$

Then the random variable being generated after $n$ seconds is:

$$X_1 + 10 X_2 + 10^2 X_3 + \cdots + 10^n X_n$$

We use the linearity of expectation to write:

$$\operatorname{E}\left({X_1 + 10 X_2 + 10^2 X_3 + \cdots + 10^n X_n}\right)$$ $$= \operatorname{E}(X_1) + 10 \operatorname{E}(X_2) + 10^2 \operatorname{E}(X_3) + \cdots + 10^n \operatorname{E}(X_n) $$

$$ = 5 + 50 + 500 + \cdots + 5 \times 10^n$$

So the answer is:

$$\underbrace{555\ldots555}_{n \text{ digits }}$$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 55c3f0bb40bc16d68554c91df17cd37d