A375925 Squares visited by a king moving on a walled, spirally numbered board, where a wall must be jumped on each move, always to the lowest available unvisited square.
1, 4, 14, 3, 11, 2, 8, 22, 7, 19, 5, 15, 33, 13, 29, 12, 28, 10, 24, 9, 23, 45, 21, 41, 20, 6, 18, 38, 17, 35, 16, 34, 60, 32, 58, 31, 55, 30, 54, 86, 52, 26, 48, 25, 47, 77, 46, 76, 44, 74, 43, 71, 42, 70, 40, 68, 39, 67, 37, 63, 36, 62, 96, 61, 95, 59, 93
Offset: 1
Keywords
Examples
For n = 2, a(2) = 4 because moving to 2 or 3 does not pass through a wall.
Links
- Sameer Khan, Table of n, a(n) for n = 1..100
- Kevin Ryde, Path Plot
Crossrefs
Programs
-
Python
def square_number(z): return int(4*y**2-y-x if (y := z.imag) >= abs(x := z.real) else 4*x**2-x-y if -x>=abs(y) else (4*y-3)*y+x if -y>=abs(x) else (4*x-3)*x+y) def A375925(n): if not hasattr(A:=A375925, 'terms'): A.terms=[1]; A.pos=0 while len(A.terms) < n: s,d = min((s,d) for d in (1, 1+1j, 1j, 1j-1, -1, -1-1j, -1j, 1-1j) if abs((s:=1+square_number(A.pos+d))-A.terms[-1]) > 2 and s not in A.terms) A.terms.append(s); A.pos += d return A.terms[n-1] # M. F. Hasler, May 07 2025
Formula
a(n) = A383185(n-1)+1. - M. F. Hasler, May 12 2025
Extensions
Entry revised by N. J. A. Sloane, May 12 2025
Comments