login
Number of (undirected) cycles on the n X 2 king graph.
2

%I #15 Feb 16 2025 08:34:01

%S 7,30,85,204,451,954,1969,4008,8095,16278,32653,65412,130939,262002,

%T 524137,1048416,2096983,4194126,8388421,16777020,33554227,67108650,

%U 134217505,268435224,536870671,1073741574,2147483389,4294967028,8589934315,17179868898,34359738073,68719476432

%N Number of (undirected) cycles on the n X 2 king graph.

%H Seiichi Manyama, <a href="/A339196/b339196.txt">Table of n, a(n) for n = 2..1000</a>

%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/GraphCycle.html">Graph Cycle</a>

%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/KingGraph.html">King Graph</a>

%F Empirical g.f.: -x^2 * (7 + 2*x) / ((-1 + x)^2 * (-1 + 2*x)). - _Vaclav Kotesovec_, Dec 09 2020

%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 A339098(n, k):

%o universe = make_nXk_king_graph(n, k)

%o GraphSet.set_universe(universe)

%o cycles = GraphSet.cycles()

%o return cycles.len()

%o def A339196(n):

%o return A339098(n, 2)

%o print([A339196(n) for n in range(2, 30)])

%Y Column 2 of A339098.

%K nonn,changed

%O 2,1

%A _Seiichi Manyama_, Nov 27 2020