# Sum of certain two-digit primes with prime digits

Let $P$ be a two-digit prime number less than $100$ such that both digits are prime numbers. What is the sum of all such numbers, $P$?

Is there a quick way to solve this problem without listing all the numbers?

• Yes. Just list those numbers both of whose digits are prime. – WillO Jan 27 '15 at 1:04
• It is not such a big list as you perhaps imagine. Note that the unit digit is quite restricted. Your Question should be fully stated within the body, not relying on the title alone for its formulation. – hardmath Jan 27 '15 at 1:25

## 2 Answers

Probably not -- the only valid digits are 2, 3, 5 and 7, so there are only 16 possibilities to check, which is surely faster than to try to be clever.

In fact, 2 and 5 clearly can't be the last digit, so there are only 8 actual values to try.

• You can eliminate two more pairs because the digits cannot be equal. – N. S. Jan 27 '15 at 1:24
• @N.S.: Yes, but then we're arguably reaching the point where it is quicker just to eliminate each of them individually than to formulate a general rule to cover them. – Henning Makholm Jan 27 '15 at 1:55

Simple in Mathematica:

Total@Select[Flatten@Outer[10 #1 + #2 &, mylist = Prime[#] & /@ Range, mylist], PrimeQ]


(* 186 *)

• And why would this solution be voted down, when "answers" that merely state which digits need be considered are voted up, such as @HenningMakholm's? – David G. Stork Jan 27 '15 at 16:57
• I didn't DV, but my guess is: Because the question isn't "what are they" but rather "is there a better way to find them?" ... and, to the extent that i can understand what you did to find them (which you didn't explain), it is the same mechanism the OP wanted to improve upon. So you aren't answering the question asked, but the question that raised this question. – Vynce Jul 20 '15 at 6:59
• The "better way" is clearly to write a single, simple line of code. – David G. Stork Jul 20 '15 at 15:46
• ...which one doesn't understand? not a great way to go about getting math right, i think. Had you said "No, because that way is this easy" and also clarified what your code did, i suspect there would have been no downvote. But the combination of not actually answering the question asked, and not answering comprehensibly, make it pretty far from a "good" answer. PS arguing with reasons given for why a downvote is a good way to stop getting reasons given. – Vynce Jul 20 '15 at 22:24