OFFSET
1,9
COMMENTS
By convention: a(1) = 0 because as 1 is a starting point of such spirals, it has no "inner neighbors" for itself.
Each n occurs A265411(n) times.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10001
Antti Karttunen, R6RS-Scheme program for computing this sequence
FORMULA
a(1) = 0; for 1 < n < 8, a(n) = 1 and for n >= 8: if either A240025(n-1) or A240025(n-2) is not zero [when n or n-1 is in A033638], then a(n) = a(n-1), otherwise, a(n) = 1 + a(n-1).
a(1) = 0; for 1 < n < 8, a(n) = 1 and for n >= 8: a(n) = a(n-1) + (1-A240025(n-1))*(1-A240025(n-2)). [The same formula in a more compact form.]
Other identities. For all n >= 0:
EXAMPLE
We arrange natural numbers as a counterclockwise spiral into the square grid in the following manner (here A stands for 10, B for 11 and C for 12). The first square corresponds with n, and the second square with the value of a(n):
55433
543C 51113C
612B 61012B
789A 71122A
7789AA
-
For each n > 1, we look for the nearest horizontally or vertically adjacent neighbor of n towards the center that is not n-1, which will then be value of a(n) [e.g., it is 1 for 4, 6 and 8, while it is 2 for 9 and 11 and 3 for 12] unless n is in the corner (one of the terms of A033638), in which case the value is the nearest diagonally adjacent neighbor towards the center.
PROG
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 09 2015
STATUS
approved