A Spirals Diagonals
Let \(n\) be a positive integer. The numbers from \(1\) to \(n^2\) are arranged into an \(n \times n\) grid in a spiral pattern, starting from the top-left corner. Let \(D(n)\) denote the sum of the diagonals of this grid.
Example: If \(n=3\) then the grid is
1 | 2 | 3 |
8 | 9 | 4 |
7 | 6 | 5 |
And so \(D(3) = 1+3+5+7+9 = 25\).
Another Example: If \(n=4\) then the grid is
1 | 2 | 3 | 4 |
12 | 13 | 14 | 5 |
11 | 16 | 15 | 6 |
10 | 9 | 8 | 7 |
And so \(D(4) = 1+4+7+10+13+14+15+16 = 80\).
Part A | Find \(D(12)\) | |
---|---|---|
Part B | Find \(D(12345)\) | |
Part C | Find \(D(123456)\) |