Answer check: What is the number of integers smaller than one million that contain two consecutive digits which are the same?

61 Views Asked by At

I try to use the Inclusion-Exclusion Principle to do this, with the component sets being $\{T_1, T_2, T_3, T_4, T_5 \}$, where $T_i$ denotes the set of 6-digits integers containing repeated digits at position $i$ and $i+1$.

The "1-fold" overlapping of the sets has size $5 \times 10^5$.

2-fold overlapping has size $10 \times 10^4$.

3-fold overlapping has size $10 \times 10^3$.

4-fold overlapping has size $5 \times 10^2$.

5-fold overlapping has size $10$.

Applying the PIE formula, I obtain $409,510$ as the number of integers smaller than one million that contain two consecutive digits which are the same.

Please comment on this answer. Thanks.

==================================================================

Edit: How do I get rid of the blanks between the "2-fold", "3-fold", etc. lines?

1

There are 1 best solutions below

0
On

If you write all numbers with six digits, so leading zeros are allowed, the 1-fold overlaps are $5\cdot 10^5$ The factor $5$ comes from choosing the position of the matching digits and you have $10$ choices for each of five digits. I think by 2-fold overlapping you mean a number with three consecutive digits the same. There are $4\cdot 10^4$ of thos because there are four places to start the three in a row. There are also cases with two pairs of consecutive digits. The inclusion-exclusion argument is hard to get right.

I would argue the question does not allow leading zeros as it is not normal to write $23$ as $000023$ and I think it should not be counted as having two consecutive matching digits. Soumik Ghosh's comment points the way to counting the numbers without consecutive digits the same. For six digit numbers there are $9^6$ as you have nine choices for each digit. For five digit numbers there are $9^5$ and so on, but for one digit numbers there are $10$ as we include $0$. The number with consecutive digits the same is then $$10^6-9^6-9^5-9^4-9^3-9^2-10=402129$$