How many integers!

This topic has expert replies
User avatar
Legendary Member
Posts: 643
Joined: Wed Aug 14, 2013 4:27 am
Thanked: 48 times
Followed by:7 members

How many integers!

by vinay1983 » Sun Aug 25, 2013 5:31 am
How many positive integers between 1 and 1000 contain the number "3" as at least one of their digits?
You can, for example never foretell what any one man will do, but you can say with precision what an average number will be up to!
Source: — Problem Solving |

GMAT/MBA Expert

User avatar
GMAT Instructor
Posts: 16207
Joined: Mon Dec 08, 2008 6:26 pm
Location: Vancouver, BC
Thanked: 5254 times
Followed by:1268 members
GMAT Score:770

by Brent@GMATPrepNow » Sun Aug 25, 2013 6:12 am
vinay1983 wrote:How many positive integers between 1 and 1000 contain the number "3" as at least one of their digits?
To make it easier on ourselves, let's consider the positive integers from 0 to 999 inclusive. As you can see, the answer will still be the same. All we have done is replaced the 1000 with 0, and neither of these have a "3"

IMPORTANT: When it comes to questions involving "at least," it's often a good idea to use the version of the complement rule that we use in probability.

That is: (# of integers with zero 3) + (# of integers with at least one 3) = total # of integers
There are 1000 integers from 0 to 999 inclusive.
So, we can write: (# of integers with zero 3's) + (# of integers with at least one 3) = 1000


# of integers with zero 3's
First take the digits from 0 to 9 and remove the "3"
This leaves us with 9 integers.
Now let's "build" some integers from 000 to 999.
First, there are 9 options for the hundreds digit.
There are 9 options for the tens digit.
There are 9 options for the units digit.
So, in total, the number of integers with zero 3's = 9 x 9 x 9 = 729


We get: (729) + (# of integers with at least one 3) = 1000
So, # of integers with at least one 3 = 271

Answer: 271

Cheers,
Brent
Brent Hanneson - Creator of GMATPrepNow.com
Image

Master | Next Rank: 500 Posts
Posts: 468
Joined: Mon Jul 25, 2011 10:20 pm
Thanked: 29 times
Followed by:4 members

by vipulgoyal » Sun Aug 25, 2013 10:51 pm
alt way

one digit no with digit 3 = 1
+
2 digit no with one and two 3 = 9 (-- fix 3 at once and tens cant be filled in 9 ways)
+
3 digit no with one 3
1*9*9(fix 3 at first position)+ 8*1*9(fix 3 at 2nd) + 9*9*1(fix 3 at third)= 234
+
3 digit no with two no of 3
1*1*9(fix 3 at 1st and 2nd) + 8*1*1( fix 3 at 2nd and 3rd) + 1*9*1 (fix 3 at first and at third)= 26
+
all three digits are 3 - 1

1+9+234+26+1= 271

Newbie | Next Rank: 10 Posts
Posts: 6
Joined: Tue Oct 29, 2013 6:46 am

by mainbhidhruv » Mon Nov 11, 2013 2:03 pm
@Brent In your Solution above you are considering 000 as a number when in question the range is 1 to 1000, why is it so- Please clarify .

When I calculate 3 digit numbers with no 3's
1 digit : 8 (1,2,4,5,6,7,8,9 )
2 digit : 8*9 = 72
3 digit : 8*9*9 = 648

8+72+648 = 728

Where am I missing 1 number, Please correct me.

GMAT/MBA Expert

User avatar
GMAT Instructor
Posts: 16207
Joined: Mon Dec 08, 2008 6:26 pm
Location: Vancouver, BC
Thanked: 5254 times
Followed by:1268 members
GMAT Score:770

by Brent@GMATPrepNow » Mon Nov 11, 2013 2:16 pm
mainbhidhruv wrote:@Brent In your Solution above you are considering 000 as a number when in question the range is 1 to 1000, why is it so- Please clarify .
Since, there are no three's in 1000, we could just ask "Among the integers from 1 to 999, how many have at least one 3?"
Likewise, there there are no three's in 000, we could just ask "Among the integers from 000 to 999 inclusive, how many have at least one 3?"
This is what I did.
I recognized that there are 1000 integers from 000 to 999 inclusive
Then I calculated there are 729 integers with zero 3's
So, the other 271 must have at least one 3.

mainbhidhruv wrote: When I calculate 3 digit numbers with no 3's
1 digit : 8 (1,2,4,5,6,7,8,9 )
2 digit : 8*9 = 72
3 digit : 8*9*9 = 648

8+72+648 = 728

Where am I missing 1 number, Please correct me.
You're almost there.
Since you don't seem to be including 1000 in your calculations, you are essentially answering the question, "Among the integers from 1to 999 inclusive, how many have at least one 3?"
Since there are 999 integers from 1 to 999 inclusive, we must subtract 728 from 999 to get 271

Same answer, different approach.

Cheers,
Brent
Brent Hanneson - Creator of GMATPrepNow.com
Image

User avatar
GMAT Instructor
Posts: 15539
Joined: Tue May 25, 2010 12:04 pm
Location: New York, NY
Thanked: 13060 times
Followed by:1906 members
GMAT Score:790

by GMATGuruNY » Mon Nov 11, 2013 4:26 pm
vinay1983 wrote:How many positive integers between 1 and 1000 contain the number "3" as at least one of their digits?
This question can be rephrased as follows:
A combination lock requires a 3-digit code that must include at least one 3. How many such codes are possible?

Total:
Between 000 and 999, inclusive, the total number of options = 1000.

Codes that do NOT include at least one 3:
Number of options for the first digit = 9. (Any digit but 3.)
Number of options for the second digit = 9. (Any digit but 3.)
Number of options for the third digit = 9. (Any digit but 3.)
To combine these options, we multiply:
9*9*9 = 729.

Thus:
Number of codes that DO include at least one 3 = 1000-729 = 271.
Private tutor exclusively for the GMAT and GRE, with over 20 years of experience.
Followed here and elsewhere by over 1900 test-takers.
I have worked with students based in the US, Australia, Taiwan, China, Tajikistan, Kuwait, Saudi Arabia -- a long list of countries.
My students have been admitted to HBS, CBS, Tuck, Yale, Stern, Fuqua -- a long list of top programs.

As a tutor, I don't simply teach you how I would approach problems.
I unlock the best way for YOU to solve problems.

For more information, please email me (Mitch Hunt) at [email protected].
Student Review #1
Student Review #2
Student Review #3

User avatar
Legendary Member
Posts: 1556
Joined: Tue Aug 14, 2012 11:18 pm
Thanked: 448 times
Followed by:34 members
GMAT Score:650

by theCodeToGMAT » Mon Nov 11, 2013 9:02 pm
A B C

if "A" is 3 --> 1 Way
"B" can be filled = 0,1,2,4,5,6,7,8,9, => 9
"c" can be filled = 0,1,2,4,5,6,7,8,9, => 9
Ways = 1 * 9 * 9 = 81
Total ways by arranging "3" in B & C places= 81*3 = 243

Now, if A & B are "3"
"c" can be filled = 0,1,2,4,5,6,7,8,9, => 9
Ways = 1*1*9 = 9
Total Ways by arranging two "3"s at different places = 9*(3!/2!) = 27

If A, B & C are "3"
Total ways = 1

Hence, Total ways = 243 + 27 + 1 = 271
R A H U L

Master | Next Rank: 500 Posts
Posts: 447
Joined: Fri Nov 08, 2013 7:25 am
Thanked: 25 times
Followed by:1 members

by Mathsbuddy » Tue Nov 12, 2013 12:17 am
Here's an alternative method that just looks at the probability of a "3" occuring at each digit.
Let's imagine a 3 digit combination lock, ABC, where A, B and C can each be any digit from 0 to 9.
The probability of spinning a 3 on each wheel is 0.1 and p(not spinning a 3) is 0.9.

p(only A = 3) = 0.9 x 0.9 x 0.1 (i.e. not A and not B and yes C)= 0.81
p(only B = 3) = 0.81
p(only C = 3) = 0.81
p(BC = 33) = 0.9 x 0.1 x 0.1 = 0.009
p(AB = 33) = 0.009
p(AC = 33) = 0.009
p(ABC = 333) = 0.1 x 0.1 x 0.1 = 0.001

The probability of any one of the above is found by adding them (or = add)

So, p(at least one 3) = 0.81 x 3 + 0.009 x 3 + 0.001 = 0.271

As there are 10^3 = 1000 combinations

we get a total of 0.271 x 1000 = 271 ways of getting at least one 3. Job done.