# Word problem involving counting

#### Petrus

##### Well-known member
Hello,
I got problem with this Word problem
Determine the number of 7-digit numbers that do not have the consequence 17th For example 4713.1572 allowed 5-digit numbers but 1723,3175,0254 are not allowed.

I did a huge progress and get answer 8457 067 but its wrong. I did calculate how many possible way i can have 17xxxxx, x17xxxx and Plenty more did take me around 2 paper.. And still get wrong. Any tips?

#### MarkFL

Staff member
I moved this topic as counting problems are typically studied in an elementary statistics/probability course. I also added a bit more description to the title.

If I understand correctly, you are to find the number of 7 digit numbers (no leading zeroes) which do not have a 1 followed by a 7 anywhere within it, right?

I think you are on the right track by finding the number of 7 digit numbers that do have the string of digits "17" within them. Then we can subtract this from the total number of 7 digits numbers.

So, first, how many 7 digit numbers in total are there?

#### Petrus

##### Well-known member
I moved this topic as counting problems are typically studied in an elementary statistics/probability course. I also added a bit more description to the title.

If I understand correctly, you are to find the number of 7 digit numbers (no leading zeroes) which do not have a 1 followed by a 7 anywhere within it, right?

I think you are on the right track by finding the number of 7 digit numbers that do have the string of digits "17" within them. Then we can subtract this from the total number of 7 digits numbers.

So, first, how many 7 digit numbers in total are there?
Sorry I forgot to report it because I was unsure.
If I understand correct you ask
xxxxxxx and the first one cant be 0 so its $9*10^6$ ( I can have 9 number on first (if it becomes zero its not a 7 digit number. then the 6 left can be any number from 0-9 that means 10 diffrent number can we have on of those x and there is 6 left )
was that your question ?

#### MarkFL

Staff member
Yes, you have correctly applied the fundamental counting principle to determine that there are a total of $9\,\times\,10^6$ seven digit numbers.

How many of these have the sequence 17 embedded within them?

#### Petrus

##### Well-known member
Yes, you have correctly applied the fundamental counting principle to determine that there are a total of $9\,\times\,10^6$ seven digit numbers.

How many of these have the sequence 17 embedded within them?
what you mean? Do u mean
$17xxxxx = 10^5-4*10^3+1+1+1= 96003$
But the other are those WHO i got problem with...

Last edited:

#### MarkFL

Staff member
Use the fundamental counting principle again, along with how many different locations the string 17 may be. First, how many possible locations are there for the sequence of digits 17?

#### Petrus

##### Well-known member
Use the fundamental counting principle again, along with how many different locations the string 17 may be. First, how many possible locations are there for the sequence of digits 17?
Do you mean how many 17 i can have in xxxxxxx? Do u mean 171717x?
ik that 17xxxxx=10^5 any number in x ) notice that there can be 17 in that counting)

#### caffeinemachine

##### Well-known member
MHB Math Scholar
Do you mean how many 17 i can have in xxxxxxx? Do u mean 171717x?
ik that 17xxxxx=10^5 any number in x ) notice that there can be 17 in that counting)
Hello Petrus,

I think its best that you post your full solution here. It will be easier to point out your mistake and lead you to the correct solution.

#### Petrus

##### Well-known member
Hello Petrus,

I think its best that you post your full solution here. It will be easier to point out your mistake and lead you to the correct solution.
I know that but I honest think its 100% wrong.. I would like to get help cause im honestly thinking I do wrong with the calculate and thinking correct

#### Petrus

##### Well-known member
What I have done so far
there is $9*10^6$ seven digit numbers and there are $10^5$ that begin with 17

#### caffeinemachine

##### Well-known member
MHB Math Scholar
I know that but I honest think its 100% wrong.. I would like to get help cause im honestly thinking I do wrong with the calculate and thinking correct
I think then resorting to recursion would be a fruitful way to neatly settle this.

Let $f_n$ be the number of numbers of $n$-digits which don't have the 'consequence' 17.

Now an allowed $7$-digit number can have the following form:
1) $axxxxxx$, $a\neq 1$.
This has $8\times (f_6+f_5+f_4+f_3+f_2+f_1)$ possibilities.

2) $1axxxxx$, $a\neq 7$.
This has $[f_6-(f_5+f_4+f_3+f_2+f_1)]+f_5+f_4+f_3+f_2+f_1=f_6$ possibilities.

Last edited:

#### Petrus

##### Well-known member
I think then resorting to recursion would be a fruitful way to neatly settle this.

Let $f_n$ be the number of numbers of $n$-digits which don't have the 'consequence' 17.

Now an allowed $7$-digit number can have the following form:
1) $axxxxxx$, $a\neq 1$.
This has $8\times (f_6+f_5+f_4+f_3+f_2+f_1)$ possibilities.

2) $1axxxxx$, $a\neq 7$.
This has $9\times (f_5+f_4+f_3+f_2+f_1)$ possibilities.
on 1) a cant neither be 0 aswell? i am right or wrong? Btw is this fundamental..? cause I am suposed to use it

#### caffeinemachine

##### Well-known member
MHB Math Scholar
on 1) a cant neither be 0 aswell? i am right or wrong? Btw is this fundamental..? cause I am suposed to use it
yes. In (1) $a\neq 0$. I didn't mention it explicitly since if $a=0$ then the number is not a $7$-digit number to begin with.

This is not really fundamental. If you have to use this solution somewhere then I think a little explanation is required.

#### Petrus

##### Well-known member
yes. In (1) $a\neq 0$. I didn't mention it explicitly since if $a=0$ then the number is not a $7$-digit number to begin with.

This is not really fundamental. If you have to use this solution somewhere then I think a little explanation is required.
I have to use fundamental :S Any tips from what I shall do next as last progress I made ?

#### caffeinemachine

##### Well-known member
MHB Math Scholar
I have to use fundamental :S Any tips from what I shall do next as last progress I made ?
Well, the technique I have used, 'recursion', is absolutely fundamental and ubiquitous in combinatorics. So in that sense the solution is fundamental. Only thing that if you have to present this solution to someone else then you'd need to give some explanation.

#### Petrus

##### Well-known member
Well, the technique I have used, 'recursion', is absolutely fundamental and ubiquitous in combinatorics. So in that sense the solution is fundamental. Only thing that if you have to present this solution to someone else then you'd need to give some explanation.
Yeah but we havent read about that so ima supose to solve with the way I am supose to do with :S

#### caffeinemachine

##### Well-known member
MHB Math Scholar
Yeah but we havent read about that so ima supose to solve with the way I am supose to do with :S
Even if you are not using this method please note that I have edited my post#11. I had previously committed a mistake.

Now,
Another method I can think of is the use of the 'Principle of Inclusion and Exclusion'. Have you read this?

#### Petrus

##### Well-known member
Even if you are not using this method please note that I have edited my post#11. I had previously committed a mistake.

Now,
Another method I can think of is the use of the 'Principle of Inclusion and Exclusion'. Have you read this?
Yes I do.

Last edited:

#### Petrus

##### Well-known member
After alot thinking and reading over this is what I think it should be done
1 we calculate all seven digit numbers, $9*10^6$
2. calculate all seven digit number from (17xxxxx, x17xxxxx, xx17xxx, xxx17xx, xxxx17x, xxxxx17) and take it away from 1. but the problem is we calculated once 1732174 but then we take it away twice from 2. (17xxxxx and xxxx17x)
So my thinking
17xxxxx= I can have 1717xxx, 17x17xx, 17xx17x, 17xxx17 (4 way) and I can also have 171717x, 17x1717, 1717x17 (3 way)... I am thinking correct? I got problem with the step 2 how to calculate.

#### Klaas van Aarsen

##### MHB Seeker
Staff member
After alot thinking and reading over this is what I think it should be done
1 we calculate all seven digit numbers, $9*10^6$
2. calculate all seven digit number from (17xxxxx, x17xxxxx, xx17xxx, xxx17xx, xxxx17x, xxxxx17) and take it away from 1. but the problem is we calculated once 1732174 but then we take it away twice from 2. (17xxxxx and xxxx17x)
So my thinking
17xxxxx= I can have 1717xxx, 17x17xx, 17xx17x, 17xxx17 (4 way) and I can also have 171717x, 17x1717, 1717x17 (3 way)... I am thinking correct? I got problem with the step 2 how to calculate.
Yep! That's it.

2. Take away the patterns 17xxxxx, x17xxxxx, xx17xxx, xxx17xx, xxxx17x, xxxxx17
3. Add the patterns 1717xxx, 17x17xx, 17xx17x, 17xxx17 and all others (10 patterns), since they have been taken away twice.
4. Subtract the patterns 171717x, 17x1717, 1717x17, x171717, since the are now not counted anymore.

Patterns 17xxxxx, x17xxxxx, xx17xxx, xxx17xx, xxxx17x, xxxxx17 represent $10^5 + 4 \cdot 9 \cdot 10^4$ numbers.

#### Petrus

##### Well-known member
Yep! That's it.

2. Take away the patterns 17xxxxx, x17xxxxx, xx17xxx, xxx17xx, xxxx17x, xxxxx17
3. Add the patterns 1717xxx, 17x17xx, 17xx17x, 17xxx17 and all others (10 patterns), since they have been taken away twice.
4. Subtract the patterns 171717x, 17x1717, 1717x17, x171717, since the are now not counted anymore.

Patterns 17xxxxx, x17xxxxx, xx17xxx, xxx17xx, xxxx17x, xxxxx17 represent $10^5 + 4 \cdot 9 \cdot 10^4$ numbers.
I react on that 9. because in 17xxxxx it does not mather but x17xxxx the first one cant be zero. I am wrong?

#### Klaas van Aarsen

##### MHB Seeker
Staff member
I react on that 9. because in 17xxxxx it does not mather but x17xxxx the first one cant be zero. I am wrong?
Correct.

#### Petrus

##### Well-known member
here is what I done that someone can correct me
1. (17xxxxx, x17xxxxx, xx17xxx, xxx17xxx, xxxx17xx, xxxx17x, xxxxx17) we got $10^5+9*6*10^5$
2.(1717xxx, 17x17xx, 17xx17x, 17xxx17, x1717xx, x17x17x, x17xx17, xx1717x, xx17x17, xxx1717) we got $4*10^3+6*9*10^2$
3.(171717x, 1717x17, 17x1717, x171717) we got $3*10+9$
and in xxxxxxx we got $9 000 000$
so I get $9 000 000-550 000+58 00-39=8 455839$ which is wrong

Last edited:

#### Klaas van Aarsen

##### MHB Seeker
Staff member
here is what I done that someone can correct me
1. (17xxxxx, x17xxxxx, xx17xxx, xxx17xxx, xxxx17xx, xxxx17x, xxxxx17) we got $10^5+9*6*10^5$
2.(1717xxx, 17x17xx, 17xx17x, 17xxx17, x1717xx, x17x17x, x17xx17, xx1717x, xx17x17, xxx1717) we got $4*10^3+6*9*10^3$
3.(171717x, 1717x17, 17x1717, x171717) we got $3*10+9$
and in xxxxxxx we got $9 000 000$
so I get $9 000 000-550 000+58 000-39=8 507 961$ which is wrong
You've got $4*10^3+6*9*10^3$ wrong.
It should be $4*10^3+6*9*10^2$.

#### Petrus

##### Well-known member
You've got $4*10^3+6*9*10^3$ wrong.
It should be $4*10^3+6*9*10^2$.
Fixed that What I am missing :O? I dont get correct.