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 #28: Number spiral diagonals

# Project Euler #28: Number spiral diagonals

# Project Euler #28: Number spiral diagonals

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

Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:

It can be verified that the sum of the numbers on the diagonals is .

What is the sum of the numbers on the diagonals in a , (N is odd) spiral formed in the same way?

As the sum will be huge you have to print the result mod

**Input Format**

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

Next lines will contain an integer .

**Constraints**

**Output Format**

Print the values corresponding to each test case.

**Sample Input**

```
2
3
5
```

**Sample Output**

```
25
101
```