OFFSET
1,1
COMMENTS
The king visits the Moore neighborhood, and the 8 possible moves relative to its current position are E, NE, N, NW, W, SW, S, and SE.
LINKS
Ruediger Jehn, Table of n, a(n) for n = 1..100
EXAMPLE
a(1) = 5: only the 3 moves E, NE, and N end on target squares on the chessboard, the other 5 leave the board.
a(2) = 6: the 6 combinations of step directions leaving the board in exactly 2 moves are [E,SW], [E,S], [E,SE], [N,NE], [N,E], and [N,SE].
MATHEMATICA
LinearRecurrence[{9, 9, -159, -108, 810, 900, -513, -729, -27, 81}, {5, 6, 39, 156, 922, 5060, 31165, 196605, 1301490, 8844147}, 25] (* Hugo Pfoertner, May 17 2025 *)
PROG
(Python)
from numpy import ones, array
P = ones((11, 11), dtype=int) # transition matrix, a1=0, b1=1, c1=2, d1=3, b2=4, c2=5, d2=6, c3=7, d3=8, d4=9, off board=10
P = [[0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 5, ],
[1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 3, ],
[0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 3, ],
[0, 0, 1, 1, 0, 1, 2, 0, 0, 0, 3, ],
[1, 2, 2, 0, 0, 2, 0, 1, 0, 0, 0, ],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, ],
[0, 0, 1, 2, 0, 1, 1, 1, 2, 0, 0, ],
[0, 0, 0, 0, 1, 2, 2, 0, 2, 1, 0, ],
[0, 0, 0, 0, 0, 1, 2, 1, 2, 2, 0, ],
[0, 0, 0, 0, 0, 0, 0, 1, 4, 3, 0, ],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]]
pop = array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=object) # king starts in a1
cycle = 100 # simulation period
for i in range(cycle):
pop = pop @ P
print(i+1, pop[10]) # Ruediger Jehn, May 17 2025
CROSSREFS
KEYWORD
nonn,walk
AUTHOR
Hugo Pfoertner, Dec 10 2024
EXTENSIONS
a(16) and beyond from Ruediger Jehn, May 17 2025
STATUS
approved
