Question 95
The numbers from $1$ to $36$ can be written in a counterclockwise spiral as follows:
| 31 | 30 | 29 | 28 | 27 |
| :---: | :---: | :---: | :---: | :---: |
| 32 | 13 | 12 | 11 | 10 |
| 33 | 14 | 3 | 2 | 9 |
| 34 | 15 | 4 | 1 | 8 |
| 35 | 16 | 5 | 6 | 7 |
| 36 | 17 | 18 | 19 | 20 |
In the figure above, all the terms on the diagonal beginning from the upper left corner have been enclosed in a box, and these entries sum up to $76$.
Suppose this spiral is continued all the way until $2015$, leaving an incomplete square. Find the sum of all the terms on the diagonal beginning from the upper left corner of the resulting (incomplete) square.
| 31 | 30 | 29 | 28 | 27 |
| :---: | :---: | :---: | :---: | :---: |
| 32 | 13 | 12 | 11 | 10 |
| 33 | 14 | 3 | 2 | 9 |
| 34 | 15 | 4 | 1 | 8 |
| 35 | 16 | 5 | 6 | 7 |
| 36 | 17 | 18 | 19 | 20 |
In the figure above, all the terms on the diagonal beginning from the upper left corner have been enclosed in a box, and these entries sum up to $76$.
Suppose this spiral is continued all the way until $2015$, leaving an incomplete square. Find the sum of all the terms on the diagonal beginning from the upper left corner of the resulting (incomplete) square.