login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Number of (undirected) cycles in the n X n torus grid graph.
7

%I #22 Dec 30 2023 13:17:46

%S 312,14704,2183490,995818716,1383238940818,5846378997135040,

%T 75162787766308673244

%N Number of (undirected) cycles in the n X n torus grid graph.

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

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/TorusGridGraph.html">Torus Grid Graph</a>.

%t Table[Length[FindCycle[GraphProduct[CycleGraph[n], CycleGraph[n], "Cartesian"], Infinity, All]], {n, 3, 5}] (* _Eric W. Weisstein_, Dec 16 2023 *)

%o (Python)

%o # Using graphillion

%o from graphillion import GraphSet

%o def make_CnXCk(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 grids.append((i + (n - 1) * k, i))

%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 grids.append((i + k - 1, i))

%o return grids

%o def A296527(n):

%o universe = make_CnXCk(n, n)

%o GraphSet.set_universe(universe)

%o cycles = GraphSet.cycles()

%o return cycles.len()

%o print([A296527(n) for n in range(3, 7)]) # _Seiichi Manyama_, Nov 22 2020

%Y Cf. A222199, A268838.

%K nonn,more

%O 3,1

%A _Eric W. Weisstein_, Dec 14 2017

%E a(7) from _Andrew Howroyd_, Dec 14 2017

%E a(8)-a(9) from _Ed Wynn_, Jun 28 2023