- All Contests
- ProjectEuler+
- Project Euler #146: Investigating a Prime Pattern

# Project Euler #146: Investigating a Prime Pattern

# Project Euler #146: Investigating a Prime Pattern

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

The smallest positive integer for which the numbers , , , , , and are consecutive primes is . The sum of all such integers below one-million is .

What is the sum of all integers below such that , , , , , are consecutive primes?

**Input Format**

The first line of input contains , the number of test cases.

The first line of each test case contains a single integer, . The second line contains six space-separated integers .

**Constraints**

**Output Format**

For each test case, output one line containing a single integer, the answer for that test case.

**Sample Input**

```
3
10
1 3 7 9 13 27
11
1 3 7 9 13 27
1000000
1 3 7 9 13 27
```

**Sample Output**

```
0
10
1242490
```

**Explanation**

As mentioned in the problem statement, the first such is , so there must be no s below . Thus, the answer for the first test case is .

The third test case is mentioned in the problem statement.