Take a crack at this problem:

*How many positive integers less than 2 x 10^4 are there in which each digit is a prime number?*

*(A) 256
(B) 326
(C) 340
(D) 625
(E) 775*

Just as problems on speeding trains can invoke feelings of dread bordering on public speaking, so too can the previous type of problem, which I refer to as counting properties. Typically, they show up about once on the GRE, and usually elicit a mixture of fear and disgust.

Yet, we shouldn’t let these problems bring us down. To attack them, I use a method I like to call the dash method. To understand how to use the dash method, let’s first try an easier GRE Math problem.

*How many three-digit numbers have a prime number in hundreds place and an even number in the tens place?*

First off, the tens digit refers to the number in the middle, and the hundreds digit refers to the leftmost number. For example, in the number 245, the 2 represents the hundreds, the 4 represents the tens and the 5 represents the units.

In order to attack this problem, let’s use a dash to stand for the hundreds, tens, and units digit, respectively.

_____ _____ _____

According to the problem, we need a number that is a prime number to go in the hundreds place, or the first of the three dashes above. So how many prime numbers match this requirement?

Most students would immediately say the number 1. But we must remember that a prime is only divisible by itself and 1. 1 is itself, so 1 is not a prime number. The lowest prime is 2. Next, we have 3, 5, and 7. What about 11? Well, in the above problem the hundreds digit can only be one number. If we were to put 11 in the hundreds column, we would then have a four-digit number.

Next, we have to take the total number of possible digits that go in the first dash. We have 2, 3, 5, and 7, so that gives us a total of 4 different numbers. Write that 4 into the leftmost dash. Now, let’s take a look at the middle number, the tens digit. Here we need an even number. That gives us 0, 2, 4, 6, and 8 (yep, zero is even). This is a total of five possibilities. So, write a 5 in the middle dash. Finally, we have the units digit. There are no restrictions here. That is, the numbers 0 – 9 can fit, giving us a total of 10 possibilities.

Using the dash method we get:

4 5 10

What do we do with the dashes? We simply multiply them and there’s our answer.

4 x 5 x 10 = 200.

Now, see if you can try the original problem.

Did you try it out? Here’s the explanation:

*How many digits less than 2 x 10^4 are there in which each digit is a prime number?*

*(A) 256
*

*(B) 326*

(C) 340

(D) 625

(E) 775

(C) 340

(D) 625

(E) 775

When using the dash method, we want to use a dash to stand for each of the digits in a problem. In this problem, we are apparently dealing with 5-digit numbers, because 2 x is equal to 20,000. The question asks us to find numbers less than 20,000 where each digit is represented by a prime number. So, let’s first set out our dashes:

___ ___ ___ ___ ___

Above each dash represents one of the five digits, from right to left, of a five-digit number. The question asks us to find how many five digit numbers are composed only of primes.

The first trick to this problem is to notice that the very first digit, the one in the leftmost dash representing the ten-thousands digit, has to be a prime. We know that the primes are 2, 3, 5, and 7. Above, the question states that the number has to be less than 20,000. The highest such number is 19,999.

Do you notice anything fishy? The ten thousands digit can only be a 1. One, however, is not a prime. Therefore, there are no five-digit numbers less than 20,000 in which each individual digit is a prime number.

Does that means we are finished with the problem? What about four-digit numbers? The problem simply says the number has to be less than 20,000, so four-digit numbers are definitely in. So, how many are composed of only prime numbers?

Now, we can use the dash method as our go-to math trick. Remember, over each dash we want to place the total number of possibilities. For each of the four digits, there are four different prime numbers—2 , 3, 5, and 7—that could work. Therefore, we will place a 4 over each dash:

4 4 4 4

Now we just have to multiply the total number of possibilities, which is equal to multiply each of the dashes together, giving us 4 x 4 x 4 x 4 = 256.

Therefore, there are 256 four-digit numbers in which every number is a prime (as an example 3, 257 is one such number, as is 2553). Are we finished? Well, what about three-digit numbers? Again we use the dashing method and we get 4 x 4 x 4 = 64.

We are still not done, because now we have to consider two-digit numbers. When we do so we get 4 x 4 = 16.

Finally, we have to consider single digits, which would be 2, 3, 5, and 7. Here, four possibilities go in the one and only dash (no need to multiply dashes), giving us 4.

The last thing we have to do is add together the total instances for four-digit, three-digit, two-digit and one-digit numbers. Doing so gives us 256 + 64 + 16 + 4 = 340, Answer Choice (C).

## GRE Math Trick Takeaway

That was a pretty tough problem, but if you are able to follow the steps and apply them to similar problems, you should no longer be cowed by these intimidating GRE math problems.

### Most Popular Resources

Okay …so one easy way to do this question is to go from right to left dashes contrary to what chris did above:

1.So for first dash with 0-9 their are only 2,3,5,7 meaning 4 possible prime digits ..easy one..

2.Next comes the second dash,0-99 provided to find the required condition, now here one must do it as a 2 dash situation which leads to …so 4×4=16…

3.Similarly for 3rd dash,from 0-999 ,we have 4x4x4=64…

4.Next comes the 4th one ,0-9999,we have 4x4x4x4=256…

5.when one considers the 5th ,unlike previous dashes where 0-9 for each dash was given,here the constraint of 0-1 limits the dash to be considered,consider a situation where 200 instead of 20,000 was the limit then one may get that only 0-99 is considered, ….

now to the anwer

4+16+64+256=359 …bingo…

in the 8th para

Here we need an even number.

didn’t get this part

Hi Aayush,

So the question says that tens place must have an even number. Therefore, there are five different numbers that can go in the tens place: 0, 2, 4, 6, and 8.

Hopefully that clears things up 🙂

Oooo Okay, I just understood the question, if you were confused by it maybe this could help:

The question is asking, for all of the numbers under 20,000, how many have every digit being a prime number. As oppose to literally writing out each number (possible, but, way too time consuming), instead what he is doing is determining how many numbers could it actually feasibly be for each digit. So with that said, under 20,000 you have five spots (19,999 – 1). It can not be anything above 10,000 because the 1 is prime so all of those numbers automatically have a prime in them, so you can discount them. So beginning with number 9,999: there are 4 digits to consider. For EACH DIGIT to be prime the only options are 2,3,5, or 7. Therefore, for each digit there are only 4 possible numbers it can be. Multiple that number for each digit (4*4*4*4) = 256. Now there are the numbers with only three digits in them (999 and down) and, once again, there are only 4 numbers that could possibly be a prime digit (2,3,5,7). So, 4*4*4 = 64. Next are the two digit numbers (99 and down) so, same 4 numbers gives us 4*4 = 16. And last but not least we have the one digit numbers (9 and below) which, of course, are 2,3,5,7. 4 possible numbers for the one digit. Add all of those results together (256+64+16+4) yields 340, answer C. To be honest, the hardest part of this problem is just understanding what it’s even asking.

Great explanation, Jennifer!

I’m sure many will find it helpful :).

uhh…its the permutation and combination method…look it up…it has always existed and is nothing new I guess..:)

Sure, it is basically the same way you would set up a permutation problem. However, I don’t like classifying these counting problems as permutation problems (it ends up confusing many people). By keeping the two discrete, and by coming up with the dash method for the counting problems, I have found that students have an easier time with this question type :).

This is a really cool trick! Thank you!!!

Great! Happy I could help!

There’s a typo here I’m assuming?

“How many **digits** less than 2 x 10^4 are there in which each digit is a prime number?”

I guess **digits** should be numbers/integers/positive integers?

Also, I couldn’t find the actual answer to this question… I’m new at Magoosh so I apologize if it’s actually floating out there and I missed it.

I disagree with answer (C). If we are considering numbers less than 2E4 i.e. 20 000, shouldn’t we also be considering all those numbers in the range 10 000 – 19 000 ? They are still less than 20 000, and add an additional 256? ( 1 * 4 * 4* 4* 4 ) ?

Yes, that is a typo. It should be positive integers. Thanks for catching that!

As for the integers in the range of 10,000 – 19,000, it is impossible for the first digit, the number in ten-thousandth place, to be a prime because that number is 1. And 1 is not a prime. So we can discount all those numbers and focus just on numbers that have four digits or less.

Aaaaaaaaaaaaah I see.

What a rookie mistake.

Thanks!

The tricky part to this question is to consider all numbers less than 20,000. If you choose answer (A) you are only considering four-digit numbers, in which case the answer is 4 x 4 x 4 x 4 = 256 (there are four possibilities for the thousands, hundreds, tens, and units).

However, we still have to consider three-digit and two-digit numbers, and single-digit numbers. 325, for instance, is a three-digit number that fits the criteria in the problem. 4 x 4 x 4 = 64. Again, a 4 for each of the three digits (hundreds, tens, and units). Two-digit numbers only yield 4 x 4 = 16. Adding these numbers together we get 336. Finally, we add the number of single digit prime numbers (2,3,5, and 7) = 4. 336 + 4 = 340. Answer (C).

Chris, can you please give the right answer.my calculations led me to choice (A).

Answer is A.

sorry, its actually C, just figured out.

Yeah, this one is definitely a tricky question.

I’m missing something here. Why is it C? Does this have to do with the wording of the question or am I calculating something wrong?