We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

Loading...

- All Contests
- ProjectEuler+
- Project Euler #9: Special Pythagorean triplet

# Project Euler #9: Special Pythagorean triplet

# Project Euler #9: Special Pythagorean triplet

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

A Pythagorean triplet is a set of three natural numbers, , for which,

For example,

Given , Check if there exists any Pythagorean triplet for which

Find maximum possible value of among all such Pythagorean triplets, If there is no such Pythagorean triplet print .

**Input Format**

The first line contains an integer i.e. number of test cases.

The next lines will contain an integer .

**Constraints**

**Output Format**

Print the value corresponding to each test case in separate lines.

**Sample Input 0**

```
2
12
4
```

**Sample Output 0**

```
60
-1
```

**Explanation 0**

- For , we have a triplet , whose product is .
- For , we don't have any pythagorean triple.