%I #15 Jan 17 2022 06:12:14
%S 1,208,4678,171592,4743130,132202038,3461461060,88405359072,
%T 2197293738684,53565801482634,1284136961473864,30365618160010650,
%U 709700882866473654,16422374051280905778,376744989106882359402,8578133199326578887346,194030408441913214687458
%N Number of (undirected) Hamiltonian paths in the 4 X n king graph.
%H Andrew Howroyd, <a href="/A339762/b339762.txt">Table of n, a(n) for n = 1..200</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/GraphPath.html">Graph Path</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/KingGraph.html">King Graph</a>
%o (Python)
%o # Using graphillion
%o from graphillion import GraphSet
%o def make_nXk_king_graph(n, k):
%o grids = []
%o for i in range(1, k + 1):
%o for j in range(1, n):
%o grids.append((i + (j - 1) * k, i + j * k))
%o if i < k:
%o grids.append((i + (j - 1) * k, i + j * k + 1))
%o if i > 1:
%o grids.append((i + (j - 1) * k, i + j * k - 1))
%o for i in range(1, k * n, k):
%o for j in range(1, k):
%o grids.append((i + j - 1, i + j))
%o return grids
%o def A(start, goal, n, k):
%o universe = make_nXk_king_graph(n, k)
%o GraphSet.set_universe(universe)
%o paths = GraphSet.paths(start, goal, is_hamilton=True)
%o return paths.len()
%o def B(n, k):
%o m = k * n
%o s = 0
%o for i in range(1, m):
%o for j in range(i + 1, m + 1):
%o s += A(i, j, n, k)
%o return s
%o def A339762(n):
%o return B(n, 4)
%o print([A339762(n) for n in range(1, 11)])
%Y Row 4 of A350729.
%Y Cf. A003695, A308129, A339760, A339761, A339763.
%K nonn
%O 1,2
%A _Seiichi Manyama_, Dec 16 2020