Number of $11-$digit length number with all $10$ digits and no consecutive same digits Here is the question:
In how many ways we can construct a $11-$digit long string that contains all $10$ digits without $2$ consecutive same digits.
Initially, I came up with $10!9$. I thought that there are $10!$ ways to construct $10-$digit number with all $10$ digits. And I can add one more digit at the end of each number in $9$ ways.
However, I found that may wrong. Because I when applied the same rule to $4-$ digit number with $3$ digits $(0,1,2)$, the answer is not $3!2$. For example, it doesn't contain $1210, 2120, 0102, ...$
So how to approach this problem?
 A: You have to repeat exactly one digit.
So, first choose the digit that you repeat (how many possibilities?), then choose where those two digits go in the number (how many possibilities?), and finally choose the order for the remaining $9$ digits (how many possibilities?)
(The answer is $163,296,000$.)
A: All your desired strings have one digit that occurs twice, while the others occur once. So here is a method to get all those strings:


*

*Place all ten digits into a ten-digit string. This can be done in $10!$ ways.

*Choose one digit to be the repeated digit. This can be done in $10$ ways.

*Choose a position in the ten-digit string from step $1$ to insert that repeated digit. The ten-digit string has $11$ places to insert, but $2$ of them are next to the same digit, so there are $9$ allowable places to insert the digit.


Inserting the digit into the position in the ten-digit string gives us an allowable eleven-digit string. However, we have double-counted every eleven-digit string, since we could have inserted the other occurrence of the repeated digit. So we must divide our count by two.
Our final count is then
$$\frac{10!\cdot 10\cdot 9}2=163,296,000$$
In your check of $4$-digit strings with $3$ digits, that would be
$$\frac{3!\cdot 3\cdot 2}2=18$$
A quick check of that in MS Excel confirms that is correct. (For the $4$-digit strings: even Excel doesn't easily handle over one hundred million lines!)
A: How many repeat digit $1$? There are $\frac{11!}{2}$ orders total but $10!$ of those have both $1$'s together (put the two $1$'s together forming a single object). Hence there are $\frac{11!}{2}-10!=\frac{9\cdot10!}{2}$ that repeat digit $1$, which implies there are $\frac{10\cdot9\cdot10!}{2}=5\cdot9\cdot10!$ total.
