Computing...
1.
\(\text{Numbers}:\\ \begin{array}{rrrrrrr} 31 & 30 & 29 & 28 & 27 & 26 & \\ 32 & 13 & 12 & 11 & 10 & 25 & \\ \ldots & 14 & 3 & 2 & 9 & 24 & \\ \ldots & 15 & 4 & 1 & 8 & 23 & \\ \ldots & 16 & 5 & 6 & 7 & 22 & \\ \ldots & 17 & 18 & 19 & 20 & 21 & \\ \end{array} \)
2.
\(\text{Coordinates of the lattice points}:\\ \begin{array}{rrrrrrr} \text{Start at $(0, 0) = 1$ }\\\\ (-3,3) & (-2,3) & (-1,3) & (0,3) & (1,3) & (2,3) & \\ (-3,2) & (-2,2) & (-1,2) & (0,2) & (1,2) & (2,2) & \\ \ldots & (-2,1) & (-1,1) & (0,1) & (1,1) & (2,1) & \\ \ldots & (-2,0) & (-1,0) & (0,0) & (1,0) & (2,0) & \\ \ldots & (-2,-1) & (-1,-1) & (0,-1) & (1,-1) & (2,-1) & \\ \ldots & (-2,-2) & (-1,-2) & (0,-2) & (1,-2) & (2,-2) & \\ \end{array}\)
3.
\(\text{Algorithem to get the lattice point coordinates:} \\ \begin{array}{|r|r|} \hline \text{lattice point number} & \text{coordinate }(x,y) \\ \hline 1.& (0,0) \\ 2.& (0,1) \\ 3.& (-1,1) \\ 4.& (-1,0) \\ 5.& (-1,-1) \\ 6.& (0,-1) \\ 7.& (1,-1) \\ 8.& (1,0) \\ 9.& (1,1) \\ 10.& (1,2) \\ 11.& (0,2) \\ 12.& (-1,2) \\ 13.& (-2,2) \\ 14.& (-2,1) \\ 15.& (-2,0) \\ 16.& (-2,-1) \\ 17.& (-2,-2) \\ 18.& (-1,-2) \\ 19.& (0,-2) \\ 20.& (1,-2) \\ 21.& (2,-2) \\ 22.& (2,-1) \\ 23.& (2,0) \\ 24.& (2,1) \\ 25.& (2,2) \\ 26.& (2,3) \\ 27.& (1,3) \\ 28.& (0,3) \\ 29.& (-1,3) \\ 30.& (-2,3) \\ 31.& (-3,3) \\ 32.& (-3,2) \\ \ldots \\ 1843.& (21,15) \\ \ldots \\ 2017.& (22,14) \\ \ldots \\ 2018.& (22,15) \\ \ldots \\ 2019.& (22,16) \\ \ldots \\ 2201.& (23,15) \\ \ldots \\ \hline \end{array}\)
4.
short algorithm to get (x,y) the index in a grid-net of the spiral in c++:
int n_max = 2818;
int y_coordinate = 0;
int x_coordinate = 0;
for(int i = 0; i < n_max; ++i) {
// output Number i+1
// output x_coordinate
// output y_coordinate
if(abs(y_coordinate) <= abs(x_coordinate) && (y_coordinate != x_coordinate || y_coordinate >= 0))
y_coordinate += ((x_coordinate >= 0) ? 1 : -1);
else
x_coordinate += ((y_coordinate >= 0) ? -1 : 1);
}
Find the lattice point coordinate of 2018.
We find (22,15).
The four numbers directly adjacent to the number “2018” in
this spiral are (21,15), (22,14), (22,16), (23,15).
The Numbers are 1843, 2017, 2019, 2201.