# [Math] How many six digit numbers start with the same two digits and end with the same three digits

big-listcombinationsdiscrete mathematics

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 count is correct.

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.