- All Contests
- ProjectEuler+
- Project Euler #60: Prime pair sets

# Project Euler #60: Prime pair sets

# Project Euler #60: Prime pair sets

_{This problem is a programming version of Problem 60 from projecteuler.net}

The primes , , , and , are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 and 109, both 7109 and 1097 are prime. The sum of these four primes, 792, represents the lowest sum for a set of four primes with this property.

Find the sum of all set of for which any two primes concatenate to produce another prime. Print the sum in sorted order.

**Input Format**

Input contains two integers separated by a space .

**Constraints**

**Output Format**

Print the sum of , one in each line.

**Sample Input**

```
100 3
```

**Sample Output**

```
107
123
```

**Explanation**

_{TL for this challenge has been adjusted as slow language like Python, PHP scaled by 1.8 times, Medium languages like Haskell are scaled 1.4 times and fast languages remains as it is.
This challenge is tested to work in C++ and Python. If there are no submission in your preferred language feel free to write in discussions page.}