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 A275609 #75 Mar 07 2020 13:50:20 %S A275609 0,1,2,3,1,2,1,3,2,0,3,0,1,4,0,2,0,3,0,3,0,2,0,1,3,1,2,1,2,3,0,2,3,1, %T A275609 3,1,2,4,1,2,1,2,1,3,1,3,2,0,2,0,3,0,3,0,1,2,1,3,1,0,2,0,4,0,1,3,0,3, %U A275609 0,3,0,3,0,2,0,2,0,1,3,1,3,1,2,1,2,1,2,3,0,3,0,2,0,2,3,1,3,1,2,3,0,2,4,1,2 %N A275609 Square spiral in which each new term is the least nonnegative integer distinct from its (already assigned) eight neighbors. %C A275609 "Neighbor" here means the eight cells surrounding a cell (cells that are a chess king's move away). The number assigned to a cell is the mex of the numbers that have already been assigned to any of its eight neighbors. - _N. J. A. Sloane_, Mar 24 2019 %C A275609 The largest element is 4 and it is also the element with lower density in the spiral. %C A275609 [Proof that 4 is the largest term. When the spiral is being filled in, the maximal number of its neighbors that have already been filled in is four. The mex of four nonnegative numbers is at most 4. QED - _N. J. A. Sloane_, Mar 24 2019] %C A275609 For more information see also A307188. - _Omar E. Pol_, Apr 01 2019 %H A275609 Alois P. Heinz, <a href="/A275609/b275609.txt">Table of n, a(n) for n = 0..100000</a> (first 5001 terms from N. J. A. Sloane) %H A275609 F. Michel Dekking, Jeffrey Shallit, and N. J. A. Sloane, <a href="https://www.combinatorics.org/ojs/index.php/eljc/article/view/v27i1p52/8039">Queens in exile: non-attacking queens on infinite chess boards</a>, Electronic J. Combin., 27:1 (2020), #P1.52. %H A275609 Rémy Sigrist, <a href="/A275609/a275609.png">Colored illustration of the sequence (with cells (x,y) such that -100 <= x <= 100 and -100 <= y <= 100)</a> %H A275609 N. J. A. Sloane, <a href="/A275609/a275609.txt">Central portion of spiral, shown without spaces</a> [The central 0 (at (0,0)) has been changed to an X. The illustration shows cells (x,y) with -35 <= x <= 35, -33 <= y <= 36.] %F A275609 a(n) = A274917(n) - 1. %e A275609 Illustration of initial terms as a spiral (n = 0..168): %e A275609 . %e A275609 . 1 - 2 - 1 - 0 - 4 - 0 - 2 - 0 - 1 - 3 - 1 - 3 - 1 %e A275609 . | | %e A275609 . 3 0 - 3 - 2 - 1 - 3 - 1 - 3 - 2 - 0 - 2 - 0 2 %e A275609 . | | | | %e A275609 . 1 2 1 - 0 - 4 - 0 - 2 - 0 - 1 - 3 - 1 3 1 %e A275609 . | | | | | | %e A275609 . 0 4 3 2 - 1 - 3 - 1 - 3 - 2 - 0 2 0 2 %e A275609 . | | | | | | | | %e A275609 . 3 1 0 4 0 - 2 - 0 - 4 - 1 3 1 3 1 %e A275609 . | | | | | | | | | | %e A275609 . 0 2 3 1 3 1 - 3 - 2 0 2 0 2 0 %e A275609 . | | | | | | | | | | | | %e A275609 . 3 1 0 2 0 2 0 - 1 3 1 3 1 3 %e A275609 . | | | | | | | | | | | %e A275609 . 0 2 3 1 3 1 - 3 - 2 - 0 2 0 2 0 %e A275609 . | | | | | | | | | %e A275609 . 3 1 0 2 0 - 2 - 0 - 1 - 3 - 1 3 1 3 %e A275609 . | | | | | | | %e A275609 . 0 2 3 1 - 3 - 1 - 3 - 2 - 0 - 2 - 0 2 0 %e A275609 . | | | | | %e A275609 . 3 1 0 - 2 - 0 - 2 - 0 - 1 - 3 - 1 - 3 - 1 3 %e A275609 . | | | %e A275609 . 0 2 - 3 - 1 - 3 - 1 - 3 - 2 - 0 - 2 - 0 - 2 - 0 %e A275609 . | %e A275609 . 1 - 4 - 0 - 2 - 0 - 2 - 0 - 1 - 3 - 1 - 3 - 1 - 3 %e A275609 . %e A275609 a(13) = 4 is the first "4" in the sequence and its four neighbors are 3 (southwest), 2 (south), 0 (southeast) and 1 (east) when a(13) is placed in the spiral. %e A275609 a(157) = 4 is the 6th "4" in the sequence and it is also the first "4" that is below the NE-SW main diagonal of the spiral (see the second term in the last row of the above diagram). %p A275609 fx:= proc(n) option remember; `if`(n=1, 0, (k-> %p A275609 fx(n-1)+sin(k*Pi/2))(floor(sqrt(4*(n-2)+1)) mod 4)) %p A275609 end: %p A275609 fy:= proc(n) option remember; `if`(n=1, 0, (k-> %p A275609 fy(n-1)-cos(k*Pi/2))(floor(sqrt(4*(n-2)+1)) mod 4)) %p A275609 end: %p A275609 b:= proc() -1 end: %p A275609 a:= proc(n) option remember; local x, y, s, m; %p A275609 x, y:= fx(n+1), fy(n+1); %p A275609 if n>0 then a(n-1) fi; %p A275609 if b(x, y) >= 0 then b(x, y) %p A275609 else s:= {b(x+1, y+1), b(x-1, y-1), b(x+1, y-1), b(x-1, y+1), %p A275609 b(x+1, y ), b(x-1, y ), b(x , y+1), b(x , y-1)}; %p A275609 for m from 0 while m in s do od; %p A275609 b(x, y):= m %p A275609 fi %p A275609 end: %p A275609 seq(a(n), n=0..120); # _Alois P. Heinz_, Mar 29 2019 %t A275609 fx[n_] := fx[n] = If[n == 1, 0, Function[k, fx[n - 1] + Sin[k*Pi/2]][Mod[ Floor[Sqrt[4*(n - 2) + 1]], 4]]]; %t A275609 fy[n_] := fy[n] = If[n == 1, 0, Function[k, fy[n - 1] - Cos[k*Pi/2]][Mod[ Floor[Sqrt[4*(n - 2) + 1]], 4]]]; %t A275609 b[_, _] := -1; %t A275609 a[n_] := a[n] = Module[{x, y, s, m}, {x, y} = {fx[n + 1], fy[n + 1]}; If[n > 0, a[n - 1]]; If [b[x, y] >= 0, b[x, y], s = {b[x + 1, y + 1], b[x - 1, y - 1], b[x + 1, y - 1], b[x - 1, y + 1], b[x + 1, y], b[x - 1, y], b[x, y + 1], b[x, y - 1]}; For[m = 0, MemberQ[s, m], m++]; b[x, y] = m]]; %t A275609 a /@ Range[0, 120] (* _Jean-François Alcover_, Feb 25 2020, after _Alois P. Heinz_ *) %Y A275609 Cf. A274912, A274917, A274920, A275606, A278354 (number of neighbors). %Y A275609 See A307188-A307192 for the positions of 0,1,2,3,4 respectively. %Y A275609 The eight spokes starting at the origin are A307193 - A307200. %K A275609 nonn %O A275609 0,3 %A A275609 _Omar E. Pol_, Nov 14 2016