login
A364130
An infinite 2d grid is filled with the positive integers by placing them clockwise in the narrow von Neumann's neighborhood of square s, the lowest number with open neighbors. a(n) is then the n-th term when the grid is read as a clockwise square spiral.
1
1, 2, 8, 3, 15, 4, 22, 5, 10, 37, 6, 31, 32, 9, 12, 84, 85, 16, 18, 154, 155, 23, 26, 11, 38, 58, 57, 7, 50, 51, 52, 33, 64, 13, 96, 97, 98, 86, 17, 19, 172, 173, 174, 156, 24, 27, 73, 39, 59, 431, 430, 429, 43, 386, 387, 388, 389, 53, 34, 65, 14, 123, 124
OFFSET
1,2
COMMENTS
This is a variant of A361207, where the size of a square's neighborhood is dependent on the value of that square rather than being of fixed size.
The neighborhood of square s is defined as the narrow von Neumann's neighborhood of radius s, see Zaitsev link. This consists of s squares in a straight line starting at square s, in each of the four directions east, south, west, and north.
To begin, 1 is placed at square (x,y) = (0,0); this then becomes square s = 1. Integers are then added sequentially to the open squares within the neighborhood of square s. The next number added to the grid is always the smallest positive integer not yet present on the grid.
Each direction of a square's neighborhood is first filled moving outwards before moving to the next direction. The order of cycling through the directions is always east, south, west, then north. Numbers are added to a given direction until either it is full, or a filled square is encountered. The process moves to the next direction regardless of any open squares remaining past the encountered filled square in that current direction of the neighborhood. Once the process has cycled through all directions of the neighborhood of a given square s, the process is repeated at square s+1.
The filled grid is then read as a clockwise square spiral, oriented east starting at (0,0). a(n) is the n-th term along the square spiral.
LINKS
EXAMPLE
For s = 2, the eastern and then southern directions are filled moving outward from s. Then in the western direction a filled square is encountered so the process moves on to the northern direction of 2's neighborhood.
For s = 3, starting in the eastern direction a filled square is immediately encountered. The process then moves to the southern direction even thought there are open squares remaining in the eastern direction of 3's neighborhood.
The spiral begins:
.
25
.
24
.
23 11
.
22---5--10
. |
21 20 19 18 4 1---2 6 7
. | |
17 16 15---3---8
.
12 9
.
13
.
14
PROG
(Python) # see linked program
CROSSREFS
Cf. A174344, A268038 (spiral coordinates).
Sequence in context: A262027 A328487 A083003 * A278117 A193976 A264244
KEYWORD
nonn,easy
AUTHOR
John Tyler Rascoe, Jul 09 2023
STATUS
approved