marevik wrote:

how many of the numbers between 0 and 1000 inclusive contain 2 or 8 digits in their record?

That's a great question, and I happy to help.

We have to be very careful in counting, so as not to count duplicates.

First, let's consider the numbers 1-100. Let's break them into "decades" (groups of ten). In most decades (0-9, 10-19, 30-39, etc.) there are just two numbers ---- those with units digits of 2 & 8 (2 & 8, 12 & 18, etc.) ---- that's two per decade. The two "exception decades" are the 20s and 80s, in which we have to count all ten digits --- so that 20 from those two "exception decades", and 2*8 = 16 from the eight other decades, for a total of 20 + 16 = 36 in the first century (group of 100).

Now, let's think about the centuries --- all centuries are going to have the same tens & units digit patterns as the first century, so most of them will have 36 just like the first century. The two "exception centuries" are the 200s and the 800s, in each of which we have to count all hundred numbers. So that's 200 numbers from the "exception centuries", and 8*36 = 288 from the other eight centuries, for a grand total of 200 + 288 =

488 ---- almost half the numbers from 0 to 1000 contain either a 2 or an 8!

Does all this make sense?

Mike

_________________

Mike McGarry

Magoosh Test Prep

Education is not the filling of a pail, but the lighting of a fire. — William Butler Yeats (1865 – 1939)