login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A361207
An infinite 2d grid is filled with the positive integers by placing them clockwise around the lowest number with open neighbors. a(n) is then the n-th term when the grid is read as a clockwise square spiral.
2
1, 2, 7, 3, 10, 4, 12, 5, 8, 16, 6, 15, 29, 17, 9, 20, 35, 21, 11, 23, 39, 24, 13, 18, 30, 46, 28, 14, 27, 45, 67, 47, 31, 19, 34, 53, 76, 54, 36, 22, 38, 58, 82, 59, 40, 25, 32, 48, 68, 92, 66, 44, 26, 43, 65, 91, 121, 93, 69, 49, 33, 52, 75, 102, 133, 103, 77
OFFSET
1,2
COMMENTS
To begin, 1 is placed at square (x,y) = (0,0); this then becomes square s = 1. Integers are added sequentially to the open squares of the neighborhood around square s. The neighborhood of a square is defined as: east (x+1,y), south (x,y-1), west (x-1,y), and north (x,y+1). The order in which numbers may be added to a neighborhood is always east, south, west, then north.
Numbers are added to open squares in the neighborhood of square s following the given order. The next number added to the grid is always the smallest positive integer not yet present on the grid. If a filled square is encountered within the current square's neighborhood, the process moves to the next direction in the order. 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.
Since each positive integer is added to the grid once, reading the grid as a spiral gives a permutation of the positive integers. Similar permutations can be created by expanding the neighborhood of s.
EXAMPLE
The spiral begins:
.
41
.
40 25 32
.
39--24--13--18--30
. |
38 23 12---5-- 8--16 28
. | | |
37 22 11 4 1---2 6 14 26
. | | | |
36 21 10---3---7 15 27
. | |
35--20---9--17--29
.
34 19 31
.
33
PROG
(Python) # see linked program
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
John Tyler Rascoe, Mar 04 2023
STATUS
approved