# How many six digit numbers start with the same two digits and end with the same three digits?

Say that there is a 6 digit number the first digit is not allowed to be 0 or 1

so

How many number combinations start with the same two digits and end with the same three digits

ie.119333, 448222, 889888 etc..

My thoughts are 8_ 1_ 10_ 10_ 1_ 1_ = 8*10*10=800?

and how would I do it if instead of the and it said Or?

first of all, I'm I on the correct path here? any other examples similar would help.

• Your title should be specific to the problem at hand so that someone who has a similar question can find it if she or he searches the site. – N. F. Taussig Oct 14 '15 at 9:54

Now let us find the number of possibilities if our number starts with the same two digits OR ends with the same three digits. Again we assume that $0$ and $1$ are forbidden as first digit. But they may occur as second digit, for example in $506888$.

There are $(8)(10^4)$ numbers that begin with two equal digits, the first (and therefore second) digit being neither $0$ or $1$.

There are $(8)(10^3)$ numbers that start with an allowed digit and whose last three digits are the same.

If we add the two numbers above, we will have double-counted the numbers in which the first two digits are the same, and the last three are the same.

It follows that the required number is $(8)(10^4)+(8)(10^3)-(8)(10^2)$.

Remark: This is a relatively simple instance of a technique called Inclusion/Exclusion. There are more elaborate versions.

• so Just minus the AND part? – learnmore Oct 14 '15 at 5:48
• Yes. A general formula for two sets is $|A\cup B|=|A|+|B|-|A\cap B|$. Here $|X|$ means the number of elements in the set $X$. – André Nicolas Oct 14 '15 at 5:53
• how would one go about in determine the count if at least one digit appears more then once in the combination.. i.e 252169 – learnmore Oct 14 '15 at 6:01
• This is a different problem, since we no longer have two identical digits at the beginning, or three at the end. I will assume that $0$ is forbidden at the beginning. Then if we had no further restrictions, the answer would be $(9)(10^5)$. Now we subtract the bad numbers, in which all digits are distinct. Let us count the bad numbers. I will stop here and continue in the next comment. – André Nicolas Oct 14 '15 at 6:11
• (Continued) For counting the bad numbers, there are $9$ choices for the first digit. For each of these there are $9$ choices for the second digit, since $0$ is now allowed. For each choice of first two digits, there are $8$ choices for third digit, and so on, for a total of $(9)(9)(8)(7)(6)(5)$. – André Nicolas Oct 14 '15 at 6:15