Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was doing some of the previous math contests and faced a question that asked me "the number of two digit primes that are still primes when the digits are reversed".

I actually wrote down every two digit primes and then checked with the condition. Honestly it was not a hard work but it took me about five minutes only for this problem while only 30 minutes are allowed for the whole test of 15 problems. And even more, I made a small mistake of thinking "91" is a prime so got this problem wrong.

So my question is, is there any special shortcut way that I can get the prime numbers quickly and without missing? What should I do if the problem asks me about three or more digit prime numbers?
Thanks! It is #7 of Part 1 [From this test]

share|cite|improve this question
up vote 2 down vote accepted

Of course you need both digits to be odd, and not to start or end with $5$.

Other than $11$, you can also eliminate cases where the digits are the same.

So you check:

$11, 13, 17, 19, 31, 37, 39, 71, 73, 79, 91, 93, 97$.

Of these, you can eliminate $39, 91, 93$ as nonprime.

From here, the answer is not hard to find: $11, 13, 17, 37, 79$ and their reverses.

For more digits, the problem won't be quite as easy since, e.g., the middle digit can be even in the three digit case. Probably a semi-smart mostly-brute-force method will be your best bet.

share|cite|improve this answer
There is 79 and 97,too :) – Free Spirit Feb 26 '14 at 2:55
@FreeSpirit Right! I should've written them all out instead of saying "and their reverses." Good catch. – Benjamin Dickman Feb 26 '14 at 2:55
Hmm, it's a little sad that there is no exact short cut but anyway thanks so much! I see it more clearly now :) It just took me some time. Thanks – Free Spirit Feb 26 '14 at 2:56
@FreeSpirit Well the two digit numbers go from $11$ to $99$, which means there are a total of eighty-nine of them. A couple quick observations reduces the number of cases to thirteen. That's a pretty good shortcut, I think! – Benjamin Dickman Feb 26 '14 at 2:59
You could also add to your starting condition that both digits should not be multiples of 3 and the sum of the digits should not be divisible by 3. That only leaves 91 to check. – RecklessReckoner Feb 26 '14 at 2:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.