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.

- All Contests
- ProjectEuler+
- Project Euler #6: Sum square difference

# Project Euler #6: Sum square difference

# Project Euler #6: Sum square difference

Contest ends in

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

The sum of the squares of the first ten natural numbers is, . The square of the sum of the first ten natural numbers is, . Hence the absolute difference between the sum of the squares of the first ten natural numbers and the square of the sum is .

Find the absolute difference between the sum of the squares of the first natural numbers and the square of the sum.

**Input Format**

First line contains that denotes the number of test cases. This is followed by lines, each containing an integer, .

**Constraints**

**Output Format**

Print the required answer for each test case.

**Sample Input 0**

```
2
3
10
```

**Sample Output 0**

```
22
2640
```

**Explanation 0**

- For ,
- For ,