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, 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
Examples
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
Links
- John Tyler Rascoe, Table of n, a(n) for n = 1..10000
- John Tyler Rascoe, Python program
- D. A. Zaitsev, A generalized neighborhood for cellular automata, Theoretical Computer Science, 666 (2017), 21-35.
- Index entries for sequences that are permutations of the natural numbers
Programs
-
Python
# see linked program
Comments