# 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. Commented Jan 27, 2015 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. Commented Jan 27, 2015 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. Commented Jan 27, 2015 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. Commented Jan 27, 2015 at 1:55

Simple in Mathematica:

Total@Select[Flatten@Outer[10 #1 + #2 &, mylist = Prime[#] & /@ Range[4], 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? Commented Jan 27, 2015 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. Commented Jul 20, 2015 at 6:59
• The "better way" is clearly to write a single, simple line of code. Commented Jul 20, 2015 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. Commented Jul 20, 2015 at 22:24