Look for a pattern #6

LP #7

Hints and answers

Determine the number of integers between 1 and 1000 that contain at least one 2 but no 3.


This is a pretty complicated counting problem. We want to count numbers like 245 and 622, because they have 2's as digits, but we don't want 532 or 392 because they have 3's in addition to their 2's.

You might try a simpler version of this first (like integers between 1 and 100), or variations (which numbers have 2's, but forget about the 3's, or without 3's and forget about the 2's).

One thing that makes this problem hard is that there is more than one way to think of the set of numbers in question. For example, you can think of it as the "intersection" of the set of numbers that have 2's with the set of numbers that have no 3's -- this is illustrated in the following Venn diagram -- the red part represents the numbers with 2's, and the blue part represents the set of numbers with no 3's, so the purple part is the set we're interested in:

Or, you could think of our set as the part of the set of numbers that have no 3's that is outside the set of numbers that have no 2's or 3's. This is shown in the following picture, where the big circle represents the set of numbers with no 3's, and the smaller circle inside it represents the set of numbers having no 2's or 3's -- we're interested in the blue ring around the smaller circle.

To decide on which way to think about our set, think about how you would count how many numbers in each of the "circle" sets, and which way would be easier.

As always, be sure to explain the work you did to arrive at your answers!