OFFSET
1,5
LINKS
Eric Weisstein's World of Mathematics, King Graph
Eric Weisstein's World of Mathematics, Spanning Tree
FORMULA
T(n,k) = T(k,n).
EXAMPLE
Square array T(n,k) begins:
1, 1, 1, 1, 1, ...
1, 16, 192, 2304, 27648, ...
1, 192, 17745, 1612127, 146356224, ...
1, 2304, 1612127, 1064918960, 698512774464, ...
1, 27648, 146356224, 698512774464, 3271331573452800, ...
PROG
(Python)
# Using graphillion
from graphillion import GraphSet
def make_nXk_king_graph(n, k):
grids = []
for i in range(1, k + 1):
for j in range(1, n):
grids.append((i + (j - 1) * k, i + j * k))
if i < k:
grids.append((i + (j - 1) * k, i + j * k + 1))
if i > 1:
grids.append((i + (j - 1) * k, i + j * k - 1))
for i in range(1, k * n, k):
for j in range(1, k):
grids.append((i + j - 1, i + j))
return grids
def A338029(n, k):
if n == 1 or k == 1: return 1
universe = make_nXk_king_graph(n, k)
GraphSet.set_universe(universe)
spanning_trees = GraphSet.trees(is_spanning=True)
return spanning_trees.len()
print([A338029(j + 1, i - j + 1) for i in range(8) for j in range(i + 1)])
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Seiichi Manyama, Nov 29 2020
STATUS
approved