- All Contests
- ProjectEuler+
- Project Euler #27: Quadratic primes

# Project Euler #27: Quadratic primes

# Project Euler #27: Quadratic primes

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

Euler published the remarkable quadratic formula:

It turns out that the formula will produce 40 primes for the consecutive values to . However, when , is divisible by , and certainly when , is clearly divisible by .

Using computers, the incredible formula was discovered, which produces primes for the consecutive values to . The product of the coefficients, and , is .

Considering quadratics of the form:

where is the modulus/absolute value of

e.g. and

Find the coefficients, and , for the quadratic expression that produces the maximum number of primes for consecutive values of , starting with .

**Note** For this challenge you can assume solution to be unique.

**Input Format**

The first line contains an integer .

**Output Format**

Print the value of and separated by space.

**Constraints**

**Sample Input**

```
42
```

**Sample Output**

```
-1 41
```

**Explanation**

for and , you get 42 primes.