OFFSET
1,1
COMMENTS
Nearby numbers on diagonals are not counted as neighbors for this sequence.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..5202
Rémy Sigrist, PARI program for A214177
FORMULA
For n >= 3, a(n+1) - a(n) = 4 except if n = k^2/4 + 3*k/2 + (17 - (-1)^k)/8 for some k >= 1 then a(n+1) - a(n) = 4*k + 16 and if n = k^2/4 + 3*k/2 + (25 - (-1)^k)/8 for some k >= 0 then a(n+1) - a(n) = -4*k - 8. - Robert Israel, Dec 14 2023
EXAMPLE
Spiral begins:
.
49 26--27--28--29--30--31
| | |
48 25 10--11--12--13 32
| | | | |
47 24 9 2---3 14 33
| | | | | | |
46 23 8 1 4 15 34
| | | | | |
45 22 7---6---5 16 35
| | | |
44 21--20--19--18--17 36
| |
43--42--41--40--39--38--37
.
The four nearest neighbors of 2 are 1, 3, 9, 11. Their sum is a(2) = 24.
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alex Ratushnyak, Jul 06 2012
STATUS
approved