How many 4 digit codes (0-9) no repetition and 5 has to be the first digit.

1 x 9 x 8 x7 first digit =5 one choice now 9 digits left. Right?

Now I am stuck. First digit has to be 5 can have repetition, but same number cannot be next to each other. 5757 or 5785 is okay.. but cannot have 5578 or 5778. So I know we start with 1 x then I am lost.
Thanks for any help

2 answers

The first part looks ok.

On the 2nd part,
The 1st digit is 5. So since the 2nd digit cannot be 5 you have only 9 choices for it. There are then 10 choices for the 3rd digit. If it is not 5, then there are 10 choices for the 4th digit. If the 3rd digit is 5, then there are 9 choices for the 4th digit. See what you can do with that.
Thanks... I will try.