2
$\begingroup$

How many five-digit numbers do not have three consecutive digits the same? Also, the initial digits might be $0$, but I'm not sure how that changes the answer.

This is the formula I've come up with for solving this problem. Total number of numbers - $A - B - C + A \cap B + B \cap C + A \cap C - A \cap B \cap C$ $$10^5 - (10^3 \cdot 3) + (10^2 \cdot 2) - 10$$

So I have set $A$, positions 1 2 3 are filled; set $B$, positions 2 3 4 are filled; set $C$, positions 3 4 5 are filled; so each set will have $10 \cdot 10 \cdot 10$ subsets of numbers that have $3$ consecutive numbers.

I know that their should be double counting because having consecutive numbers in positions 1 2 3 4 and 2 3 4 5 should be added back, and consecutive numbers 1 2 3 4 5 will need to be subtracted.

So, I get $$10^5 - (10^3 \cdot 3) + (10^2 \cdot 2) - 10 = 100000 - 3000 + 200 - 10 = 97190$$

However, this is not the correct answer. What is the correct procedure to solve this problem? Or what way am I to look at counting up the sets?

Thanks

$\endgroup$
  • $\begingroup$ To subtract the numbers with at least three consecutive digits the same, notice that at most one of 0,1,...,9 can repeat thus. Fix this digit, it can occur 5 times, or exactly 4 times consecutively or exactly 3 times consecutively. $\endgroup$ – Aravind Oct 17 '15 at 6:58
  • $\begingroup$ Please read this tutorial on how to typeset mathematics on this site. $\endgroup$ – N. F. Taussig Oct 17 '15 at 8:47
2
$\begingroup$

There's one mistake and one possible misinterpretation.

The mistake is that you only substracted $10^2$ twice for $|A\cap B|$ and $|B\cap C|$, but $|A\cap C|$ is missing. This is actually the same as $|A\cap B\cap C|$, since in both cases all five digits have to be equal; so those two cancel and the correct total would be $10^5-3\cdot10^3+2\cdot10^2+10^1-10^1=97200$.

The potential misinterpretation is that the problem may have meant only "proper" five-digit numbers that don't start with a $0$.

$\endgroup$
  • $\begingroup$ I edited the question for addressing the issue with initial 0. Thanks for pointing that out. So I'm assuming that I'm supposed to count 00000 as a number. $\endgroup$ – WP0987 Oct 17 '15 at 7:45
  • 1
    $\begingroup$ @joriki: Your final result has a typo which should be 97200, a 5-digit number. $\endgroup$ – P Vanchinathan Oct 17 '15 at 7:58
  • $\begingroup$ @PVanchinathan: Thanks, fixed. $\endgroup$ – joriki Oct 17 '15 at 8:23
  • $\begingroup$ @WP0987: Yes (which doesn't correspond to the usual meaning of the word "number"). Does the result match the answer you were given? $\endgroup$ – joriki Oct 17 '15 at 8:26
  • $\begingroup$ Am I misinterpreting the question ? $\endgroup$ – true blue anil Oct 17 '15 at 10:57
2
$\begingroup$

I would do simple subtraction, viz.

all "numbers" - [all 5 digits same + 4 consecutive digits same + 3 consecutive digits same]

e,g, with consecutive 0's, the patterns can be: 00000 , x0000, 0000x, 000xx , x000x and xx000

$10^5 - [ 10 + 2\cdot10\cdot9 + 10\cdot9^2 + 2\cdot 10\cdot9\cdot10 ] = 97200$

$\endgroup$
  • $\begingroup$ In the last line, the signs are correct; in the second line they're wrong. $\endgroup$ – joriki Oct 17 '15 at 12:08
  • $\begingroup$ @joriki:Thanks, I think I need coffee ! $\endgroup$ – true blue anil Oct 17 '15 at 12:11
  • $\begingroup$ @trueblueanil yes 97200 is the correct answer. However, I having trouble understanding the math. 10^5 (all 5 digit numbers) minus [ 10 (all 5 digits same) plus 2⋅10⋅9+10⋅9^2 +2⋅10⋅9⋅10 ]. I'm confused about how the rest of the numbers are derived. $\endgroup$ – WP0987 Oct 17 '15 at 16:40
  • 1
    $\begingroup$ Two patterns with 5 same, oooox and xoooo , 10 choices for the string of o's, but only 9 choices for the x, so $2\cdot10\cdot9$. Three patterns with 3 same, xooox $(10\cdot9^2)$ but in the remaining 2 patterns, xxooo & oooxx the extreme x's have 10 choices. You should be able to figure it out now. $\endgroup$ – true blue anil Oct 17 '15 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.