OFFSET
4,1
REFERENCES
D. E. Knuth, Long and skinny knight's tours, in Selected Papers on Fun and Games, to appear, 2010.
LINKS
George Jelliss, Open knight's tours of three-rank boards, Knight's Tour Notes, note 3a (21 October 2000).
George Jelliss, Closed knight's tours of three-rank boards, Knight's Tour Notes, note 3b (21 October 2000).
EXAMPLE
The three distinct 3x4 tours were published by Euler in Memoires Acad. Roy. Sci. (Berlin, 1759), 310-337.
PROG
(Python)
def a(n):
moves = [(1, 2), (1, -2), (-1, 2), (-1, -2), (2, 1), (2, -1), (-2, 1), (-2, -1)]
graph = {(r, c): [(r+dr, c+dc) for dr, dc in moves if 0<=r+dr<3 and 0<=c+dc<n]
for r in range(3) for c in range(n)}
paths = []
def bt(cur, vis):
if len(vis) == 3*n:
paths.append(tuple(vis)); return
for nb in graph[cur]:
if nb not in vis:
vis.append(nb)
bt(nb, vis)
vis.pop()
for r in range(3):
for c in range(n):
bt((r, c), [(r, c)])
def canon(p):
rot = lambda q: tuple((2-r, n-1-c) for r, c in q)
rh = lambda q: tuple((2-r, c) for r, c in q)
rv = lambda q: tuple((r, n-1-c) for r, c in q)
s = set()
for x in [tuple(p), tuple(reversed(p))]:
for t in [lambda q:q, rot, rh, rv]:
s.add(t(x))
return min(s)
return len({canon(p) for p in paths}) # Steven Kotlarz, Mar 08 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, May 10 2010, based on a communication from Don Knuth, Apr 28 2010
STATUS
approved
