In my experience, if it is difficult to calculate a probability, it is sometimes easier to calculate the inverse.
So how many 10 digit strings do not contain consecutive 0s?
We can ignore the first digit since one digit in of itself will have no impact on the probability.
From there, the probability that a single digit does not cause that string to contain consecutive 0s is inverse of the the probability that both the previous and the current digits are 0.
So if we were solving for 2 digit strings, the probability would simply be the inverse of the probability of having 0 digit followed by another 0 digit, or $1 - (\frac{1}{10\times10})$.
If we were to then apply this to a 3 digit string, the probability would be compounded with the inverse of the probability of the last digits having 0. This simply means to find the probability of not finding 0s in the first two digits and not finding 0s in the second two digits. This also covers the case of both finding digits in the first 2 digits as well as finding digits in the last 2 digits.
The probability of the first two digits not both having 0 is $1 - (\frac{1}{10\times10})$, and the probability of the last two digits not both having 0 is $1 - (\frac{1}{10\times10})$. Compounded, you would get $$1 - \frac{1}{\frac{1}{1 - (\frac{1}{10\times10})}\times\frac{1}{1 - (\frac{1}{10\times10})}}$$ Simplying a bit, we get:
$$1 - (1 -\frac{1}{10\times10})^{2}$$
Why the 2? Because we have 3 digits and 2 pairs of digits to consider. Generalizing, we would have:
$$1 - (1 - \frac{1}{10\times10})^{n-1}$$
Where $n$ is the number of digits. Take this probability and multiply times $10^n$ or in this case $10^{10}$ (total number of possible combinations) and you get the number of digits containing consecutive zeros.
It would seem that you're making the mistake of assuming the pattern is linear. When you're finding all configurations of non-0 digits in the case in which m is 1, there should be just as many configurations of 0 digits in the case in which m is 9. So:
$$xxxxxxxxx0,0xxxxxxxxx$$
If your linear calculation were accurate, then there should be 10000000000 ways to place that singular 0 digit! Hope that helps!
You say you have $9000$ four-digit numbers.
To count numbers with no consecutive repeat digits is quite easy: you say you have $9$ choices for the first digit; given the first you have $10-1=9$ choices for the second; given the second you have $9$ choices for the third; given the third you have $9$ choices for the fourth.
$$\dfrac{9^4}{9 \times 10^3} = 0.729$$ so if this is what you were trying to do then you have made a mistake.
(Added) If alternatively you are looking for the numbers which do not have any consecutive $5$s, the easiest way to count is to look at those which do, as you attempted.
There are three possible patterns of the forms 55AA
, B55A
or CD55
where A
is any digit , B
is any digit except $0$ or $5$, C
is any digit except $0$, and D
is any digit except $5$. So there are $10\times 10 + 8 \times 10 + 9\times 9 = 261$ four-digit numbers which have consecutive $5$s and so $9000-261 = 8739$ which do not.
$$\dfrac{8739}{9000} = 0.971$$ so again you have an error, but much closer this time. You might try to spot how you have over counted the second two patterns
Best Answer
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:
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!)