Discrete math question

colerelm

New member
Joined
Oct 24, 2011
Messages
33
I have the answer for the first part of this question but how would I get the second part?

How many integers from 1 through 9999 have distinct digits? How many
contain exactly one 7 and one 9?
Note that digit strings with leading zeroes (like 085)
are not considered valid integers.

I have an answer of 814 but I'm not sure if that's right because the steps I took don't feel right...
 
Next time, please explain what you tried or thought about, when posting for guidance.

I think this is a basic counting problem.

How many possible positions can the 7-digit occupy?

Once the 7-digit is positioned, how many remaining positions are possible for the 9-digit?

Multiply these two answers.

Cheers :cool:


 
Next time, please explain what you tried or thought about, when posting for guidance.

I think this is a basic counting problem.

How many possible positions can the 7-digit occupy?

Once the 7-digit is positioned, how many remaining positions are possible for the 9-digit?

Multiply these two answers.

Cheers :cool:


I suspect this is a bit more complex than multiplying two numbers.

See my post below. My original explanation was flawed.
 
Last edited:
Correction to first post

In two-digit numbers, there are 10 numbers that begin with 7, but 77 is to be excluded, giving 9.

And there are 9 two-digit numbers that have a 7 as the second digit, but 77 is to be excluded, giving 8.

So there are 17 two-digit numbers that contain exactly one 7.

Similarly there are 17 two-digit numbers that contain exactly one 9.

But this counts 79 and 97 twice.

So the answer is 17 + 17 - 2 = 32.

17, 19, 27, 29, 37, 39, 47, 49, 57, 59, 67, 69, 87, 89, 70, 71, 72, 73, 74, 75, 76, 78, 79, 90, 91, 92, 93, 94, 95, 96, 97, 98.
 
Last edited:
Um I think either I am very confused or the question was misinterpreted. The way I interpreted "How many
contain exactly one 7 and one 9?"
is that we count the following numbers as options:

79, 7?9,9?7, 97?, 79?, ??79, ?7?9, 7??9, 7?9?, 79??....etc. (not sure how many more there are so i'll stop here).
 
Correction to first post

In two-digit numbers, there are 10 numbers that begin with 7, but 77 is to be excluded, giving 9.

And there are 9 two-digit numbers that have a 7 as the second digit, but 77 is to be excluded, giving 8.

So there are 17 two-digit numbers that contain exactly one 7.

Similarly there are 17 two-digit numbers that contain exactly one 9.

But this counts 79 and 97 twice.

So the answer is 17 + 17 - 2 = 32.

17, 19, 27, 29, 37, 39, 47, 49, 57, 59, 67, 69, 87, 89, 70, 71, 72, 73, 74, 75, 76, 78, 79, 90, 91, 92, 93, 94, 95, 96, 97, 98.


hmm I dont think this is right because the problem is asking for, of the 1-9999 unique values found in part one of this equation, which of them have exactly one 7 and exactly one 9 in them. 7009 would be one of those numbers, for example. I don't think the problem meant "look for values with only one 9 (and no 7s) or only one 7 (and no 9s)." Anyone else have any thoughts?
 
Um I think either I am very confused or the question was misinterpreted. The way I interpreted "How many
contain exactly one 7 and one 9?"
is that we count the following numbers as options:

79, 7?9,9?7, 97?, 79?, ??79, ?7?9, 7??9, 7?9?, 79??....etc. (not sure how many more there are so i'll stop here).
I think I am going to go to bed. You are right. I have misread the question twice.

79 and 97 plus three-digit numbers with one 7 and one 9 plus four-digit numbers with one 7 and one 9.

How many ways can you permute 3 distinct things? 6. And the third digit can be any one of 7, namely 1, 2, 3, 4, 5, 6, and 8.
So 7 * 6 = 42.

The four-digit numbers are harder because 1279 and 2179 differ but 1179 is the same number as 1179.

I am too sleepy to try to work it out (given I have erred twice already tonight), but maybe this is a sufficient hint.
 
Hello, colerelm!

I have the answer for the first part of this question, but how would I get the second part?

(a) How many integers from 1 through 9999 have distinct digits?
(b) How many contain exactly one 7 and one 9?
(Leading zeroes are not allowed.)

One-digit numbers: 0


Two-digit numbers: \(\displaystyle 2\) .(79 and 97)


Three-digit numbers: .\(\displaystyle \square\;\square\;\square\)

(1) The first box is 7 or 9: \(\displaystyle 2\) choices.
The other digit has a choice of \(\displaystyle 2\) boxes.
The last box can be filled in \(\displaystyle 10\) ways.
. . . \(\displaystyle 2\cdot2\cdot10 \,=\, 40\)

(2) The first box is not 7 or 9 or 0: \(\displaystyle 7\) choices.
The 7 and 9 can be placed in \(\displaystyle 2\) ways.
. . . \(\displaystyle 7\cdot2 \:=\:14\)

There are: .\(\displaystyle 40 + 14 \:=\:54\) three-digit numbers.


Four-digit numbers: .\(\displaystyle \square\;\square\;\square\;\square\)

(1) The first box is 7 or 9: \(\displaystyle 2\) choices.
The other digit has a choice of \(\displaystyle 3\) boxes.
The other two boxes can be filled in: \(\displaystyle 10^2\) ways.
. . . \(\displaystyle 2\cdot3\cdot100 \:=\:600\)

(2) The first box is not 7 or 9 or 0: \(\displaystyle 7\) choices
The 7 and 9 can be placed in \(\displaystyle _3P_2 = 6\) ways.
The third box can be filled in \(\displaystyle 10\) ways.
. . . \(\displaystyle 7\cdot6\cdot10 \:=\:420\)

There are: .\(\displaystyle 600 + 420 \:=\:1020\) four-digit numbers.


Therefore: .\(\displaystyle 2 + 54 + 1020 \:=\:1076\) such numbers.
 
Let's try this again.

Each string is to contain 4 digits, including exactly one 7 and exactly one 9, but strings in the form 00zz or 0zz are excluded. So 79 is not a valid member of the set because it would be shown as 0079, and 970 is not a member because it would be shown as 0970.

There are 4 * 3 = 12 basic structures for placing the 7 and the 9.

7xx9, 7x9x, 7xx9,
x7x9, x79x, 97xx,
xx79, x97x, 9x7x,
xx97, x9x7, 9xx7

6 of the basic structures have a 7 or a 9 in the initial position. For each of those, there are 8 ways to fill the first position that is neither a 7 nor a 9, namely 0, 1, 2, 3, 4, 5, 6, and 8, and, similarly 8 ways to fill the second position.

6 * 8 * 8 = 384.

6 of the basic structures have a digit other than 7 or 9 in the first position. There are only 7 ways to fill that first position, namely 1, 2, 3, 4, 5, 6, and 8. The remaining digit, however, may be 0 because it is not a leading digit. So there are 8 ways to fill that position.

6 * 7 * 8 = 336

384 + 336 = 720.

I am going to sit in the corner with denis because of all my blunders last night, for which I apologize,

I am also going to check programmatically.

EDIT: I checked via a program. It too finds the answer to be 720. I suppose I could have made two errors that coincidently reach the same result, but that seems unlikely, even for me.
 
Last edited:
Top