This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A364130 #26 Nov 17 2023 21:37:41 %S A364130 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, %T A364130 58,57,7,50,51,52,33,64,13,96,97,98,86,17,19,172,173,174,156,24,27,73, %U A364130 39,59,431,430,429,43,386,387,388,389,53,34,65,14,123,124 %N 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. %C A364130 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. %C A364130 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. %C A364130 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. %C A364130 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. %C A364130 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. %H A364130 John Tyler Rascoe, <a href="/A364130/b364130.txt">Table of n, a(n) for n = 1..10000</a> %H A364130 John Tyler Rascoe, <a href="/A364130/a364130_1.txt">Python program</a> %H A364130 D. A. Zaitsev, <a href="https://doi.org/10.1016/j.tcs.2016.11.002">A generalized neighborhood for cellular automata</a>, Theoretical Computer Science, 666 (2017), 21-35. %H A364130 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A364130 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. %e A364130 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. %e A364130 The spiral begins: %e A364130 . %e A364130 25 %e A364130 . %e A364130 24 %e A364130 . %e A364130 23 11 %e A364130 . %e A364130 22---5--10 %e A364130 . | %e A364130 21 20 19 18 4 1---2 6 7 %e A364130 . | | %e A364130 17 16 15---3---8 %e A364130 . %e A364130 12 9 %e A364130 . %e A364130 13 %e A364130 . %e A364130 14 %o A364130 (Python) # see linked program %Y A364130 Cf. A174344, A268038 (spiral coordinates). %Y A364130 Cf. A090915, A217010, A337822, A361207. %K A364130 nonn,easy %O A364130 1,2 %A A364130 _John Tyler Rascoe_, Jul 09 2023