Add-ins:
Excel
PowerPoint

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

21 22 23 24
25

20 7
8 9
10

19 6 1
2 11

18 5
4 3
12

17 16 15 14
13

It can be verified that the sum of both diagonals is 101.

What is the sum of both diagonals in a 1001 by 1001 spiral formed in the same way?

The idea of simply filling out the 1001x1001 matrix was intimidating whether I did it by code or "by hand." A smarter approach seemed to be to figure out what the diagonal elements would be.

The numbers on the half-diagonal starting with 1 and moving towards
the bottom right, are F_{0}=1 F_{1}=3 F_{2}=13...F_{i}=F_{i-1}
+ (F_{i-1} + F_{i-2} + 8) for i=2,3,...

The numbers on the half-diagonal starting with 1 and moving towards
the bottom left are G_{i}=F_{i}+2*i.

Similarly, the numbers on the half-diagonal starting with 1 and
moving towards the top left are H_{i}=G_{i}+2*i.

Finally, the numbers on the half-diagonal starting with 1 and moving
towards the top right are J_{i}=H_{i}+2*i.

The last piece we need to recognize is that a 1001x1001 matrix will have 500 elements in each half-diagonal excluding the common center value of 1.

We can now set this up in Excel and solve the problem with no code support.

Start by entering the column headers and the values of F_{0}
and F_{1}. These are cells A2 and A3 respectively.

Calculate the values of G_{1}, H_{1}, and J_{1}
(cells B3:D3 respectively) as well as the values in the next row (i.e.,
row 4) corresponding to i=2. Then, copy the contents of A4:D4 down
to 5:205.

Finally, use the formula =SUM(A3:D502,A2) to get the desired result.