1
$\begingroup$

This is the Question: How many positive, three digit integers contain atleast one 7?

For these kind of questions I have always followed a technique of first taking care of the restriction provided in the question. The Restriction is contain atleast one 7

This is similar to the question:

In how many ways can the five letters J,K,L,M,N can be arranged such that L is not in the middle. Well for this question,taking care of the restriction, I know that the middle letter stage can be accomplished in 4 ways since it cannot contain L, so the combination is

$4\cdot3\cdot4\cdot2\cdot1 = 96$ ways.

But the above technique is not working for the question I asked. How to use the same technique where I first tackle with the restriction and then move on with the question.

What I tried:

Three Cases are possible:

1) Three Digits with atleast one seven: $1\cdot8\cdot7 = 56$ ways

2) Three Digits with atleast two seven: $1\cdot1\cdot8 = 8$ ways

3) Three Digits with atleast three seven: $1\cdot1\cdot1 = 1$ way

So, it should be $56\cdot8 = 448$ ways but thats wrong, The answer is 252 ways

So, how can I solve this question with the same strategy that I have followed of taking care of the restrictions first?

$\endgroup$
  • 2
    $\begingroup$ Hint: try to find all 3-digit integers without $7$ $\endgroup$ – Michael Galuza Jul 19 '15 at 5:54
  • $\begingroup$ yeah..thats what the second strategy is but I want to stick with one single strategy and master it which is taking care of that restriction first $\endgroup$ – user2401175 Jul 19 '15 at 5:55
  • $\begingroup$ Where does the $8$ in $56 \cdot 8$ come from? It is certainly not the number of permutations of three digits (with or without repetitions). If anything, brute-forcing a solution this way is a good advertisement for using the sort of strategy Michael suggested for this sort of problem in general. $\endgroup$ – Travis Willse Jul 19 '15 at 5:58
  • $\begingroup$ @Travis: I thought multiplying the number of ways in my first case with the second case will be the answer. so thats where 56*8 comes from? $\endgroup$ – user2401175 Jul 19 '15 at 5:59
  • $\begingroup$ @Travis: Then how ccome the strategy works for that alphabets question that I have posted and does not work for this one? I mean there should be some way right? with the same strategy? $\endgroup$ – user2401175 Jul 19 '15 at 6:01
3
$\begingroup$

I think the analogy with the permutations of letters is making this problem more complicated than it needs to be.

Using the restriction that the number has at least one seven, you can first find the numbers that have exactly one $7$, then the numbers that have two $7$s, and then the number that has three $7$s and then add the results.

To find the number of numbers, think of choosing a digit for each spot: _ _ _

For one seven, you can fix a $7$ in a spot, say the first one, so the number looks like 7_ _ and note that for the other spots you can have any of the other 9 digits ($0,1,2,3,4,5,6,8,$ or $9$), so there are $9\cdot 9=81$ such numbers.

For numbers of the forms _ 7 _ and _ _ 7 the count is different because the first digit cannot be $0$, so there are $8\cdot 9=72$ possibilities for each.

Thus, in total there are $72+72+81=225$ three-digit positive integers with one seven as a digit.

Two sevens: For the form _77 there are 8 possibilities because the first spot cannot be 0, and for each of the forms 7_7 and _ _7 there are 9 possibilities, so in total there are $8+9+9=26$ three-digit positive integers with one seven as a digit.

Three sevens: There is only one, $777$.

So in total there are $225+26+1=252$ three-digit integers with a seven as a digit.

$\endgroup$
  • 1
    $\begingroup$ thank you so much man..Thats what I was asking, yeah the analogy with that letters question made it harder for me $\endgroup$ – user2401175 Jul 19 '15 at 6:24
3
$\begingroup$

A simple way.

  1. The first digit is 7. There are 100 of such numbers.

  2. The first digit is not 7 but the second is. There are $8\cdot10=80$ such numbers.

  3. The first and second digit are not 7 andthe last one is 7. There are $8\cdot9=72$ (the first must be nonzero) such numbers, which gives the desired 252.

$\endgroup$

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.