I'm trying to find a formula for spiral filling of an array.
Example:
0 1 2 3 4
11 12 13 14 5
10 9 8 7 6
My formula is based on "corners" of a spiral. The "corners" are bold in the example. With coordinates of the cell, we can find coordinates of biggest "corner" less than the number we want to find. With coordinates of "corner", we can find the index of this "corner". With the index of corner number, we can find the number. How to find the formula for corner number by its index?