OFFSET
0,8
COMMENTS
Similar to A274641, except that here we consider the mex of squares that are a knight's moves rather than queen's moves.
Since there are at most 4 earlier cells in the spiral at a knight's move from any square, a(n) <= 4.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..9999
F. Michel Dekking, Jeffrey Shallit, and N. J. A. Sloane, Queens in exile: non-attacking queens on infinite chess boards, Electronic J. Combin., 27:1 (2020), #P1.52.
N. J. A. Sloane, Beginning of the spiral showing the initial values.
EXAMPLE
A knight at square 0 cannot see any numbers, so a(0)=0. Similarly a(1)=a(2)=a(3)=0.
A knight at square 4 in the spiral can see the 0 in square 1 (because square 1 is a knight's move from square 4), so a(4) = 1. Similarly a(5)=a(6)=1.
A knight at square 7 can see a(2)=0 and a(4)=1, so a(7) = mex{0,1} = 2.
And so on. See the illustration for the start of the spiral.
PROG
(Python)
from itertools import islice
def square_spiral(): # generator of square spiral coordinates
i, j, di, dj, L = 0, 0, 1, 0, 1
yield i, j
while True:
for s in range(2):
for k in range(L):
i, j = i+di, j+dj
yield i, j
di, dj = -dj, di
L += 1
def A308884_gen(): # generator of terms
ss = square_spiral()
loc, dir, a = next(ss), 0, dict()
K = {(2, 1), (1, 2), (-1, 2), (-2, 1), (-2, -1), (-1, -2), (1, -2), (2, -1)}
while True:
sees = {a.get((loc[0]+i, loc[1]+j), -1) for i, j in K}
mex = min(set(range(-1, max(sees)+2)) - sees)
yield mex
a[loc] = mex
loc = next(ss)
print(list(islice(A308884_gen(), 94))) # Michael S. Branicky, Feb 05 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Jul 01 2019
STATUS
approved
