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

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.

To find the number of 4-digit codes without repetition where 5 has to be the first digit, you can break down the problem into stages.

Stage 1: Selecting the first digit
Since the first digit must be 5, there is only one choice for this digit. So, the result for this stage is 1.

Stage 2: Selecting the second digit
Now that the first digit is fixed as 5, we need to select the second digit from the remaining 9 digits (0-9 excluding 5). Since repetition is not allowed, we have 9 choices for the second digit. So, the result for this stage is 9.

Stage 3: Selecting the third digit
Similar to Stage 2, we need to select the third digit from the remaining 8 digits (0-9 excluding 5 and the digit already chosen in Stage 2). This gives us 8 choices for the third digit. So, the result for this stage is 8.

Stage 4: Selecting the fourth digit
Again, we need to select the fourth digit from the remaining 7 digits (0-9 excluding 5 and the digits already chosen in Stages 2 and 3). This gives us 7 choices for the fourth digit. So, the result for this stage is 7.

To find the total number of 4-digit codes satisfying the given conditions, we multiply the results of each stage together:

Total = 1 x 9 x 8 x 7 = 504

Therefore, there are 504 different 4-digit codes without repetition where 5 is the first digit.