Passwords consist of digits. A password is valid if it contains the same digit at least twice in a row. For example 4558, 000637 and 33972240 are valid passwords but 8385878 is not a valid password. Let $a_n$ denote the number of different valid passwords of length $n$.
I have been having trouble to figure out how to find a recurrence relation for this problem. I figured the password has to have at least two digits, so $a_2$ would be 10 possibilities(00,11,22,...,99)
Does anyone know if I am on the right track, and how to find the recurrence relation?
You're asking for a recurrence, and @YaniorWeg provided a nice answer. But the whole problem is much easier solved by counting the complement. I.e. How many strings have every pair of adjacent digits being different? I.e. How many strings have every digit (except the leftmost) being different from its left neighbor? Well, that's just $10 \times 9 \times 9 \times 9 \times ... = 10\times 9^{n-1}$.