# In how many sequences $n$ terms long does $x$ appear?

How many sequences $$n$$ terms long exist where each term is a number from $$0$$-$$9$$, and a specific number, let’s say $$x$$, is present anywhere in the sequence.

I thought to solve this by taking all the possible sequences, $$10^n$$, and subtracting from it the sequences where $$x$$ is not present, meaning $$9^n$$.

Is this correct?

So for a sequence $$2$$ terms long, there are $$19$$ sequences where the number $$2$$ appears.

• This question is nearly equivalent to asking How many $n$-digit numbers have $x$ in them? That said, your solution seems correct. – Naman Kumar Jan 22 at 13:31
• Your solution is correct. – N. F. Taussig Jan 22 at 13:36