- All Contests
- ProjectEuler+
- Project Euler #51: Prime digit replacements

# Project Euler #51: Prime digit replacements

# Project Euler #51: Prime digit replacements

_{This problem is a programming version of Problem 51 from projecteuler.net. We highly recommend to solve original first}

By replacing the digit of , it turns out that six of the nine possible values: , , , , , and , are all prime.

By replacing the and digits of with the same digit, this number is the first example having seven primes among the ten generated numbers, yielding the family: , , , , , , and . Consequently , being the first member of this family, is the smallest prime with this property.

Find the smallest prime which, by replacing of the number (not necessarily adjacent digits) with the same digit, is part of an prime value family.

**Note1:** It is guaranteed that solution does exist.

**Note2:** Leading zeros should not be considered.

**Note3:** If there are several solutions, choose the "lexicographically" smallest one (one sequence is considered "lexicographically" smaller than another if its first element which does not match the corresponding element in another sequence is smaller)

**Input Format**

Input contains three integers , and .

**Output Format**

Print the first L numbers of the prime value family found in increasing order.

**Constraints**

**Sample Input#00**

```
5 2 7
```

**Sample Output#00**

```
56003 56113 56333 56443 56663 56773 56993
```

**Sample Input#01**

```
2 1 3
```

**Sample Output#01**

```
11 13 17
```