cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A339798 Number of (undirected) Hamiltonian paths in the graph C_4 X C_n.

This page as a plain text file.
%I A339798 #17 Feb 16 2025 08:34:01
%S A339798 4128,45696,287160,2172480,11866848,76468352,390714840,2301083680,
%T A339798 11288784144,62812654272,299720429528,1604776566400,7505573487360,
%U A339798 39105991164160,180179056818584,920223907284960,4191443432295472,21088555826121280,95195388883597464,473503955161244480
%N A339798 Number of (undirected) Hamiltonian paths in the graph C_4 X C_n.
%H A339798 Seiichi Manyama, <a href="/A339798/b339798.txt">Table of n, a(n) for n = 3..50</a>
%H A339798 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/HamiltonianPath.html">Hamiltonian Path</a>
%H A339798 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/TorusGridGraph.html">Torus Grid Graph</a>
%o A339798 (Python)
%o A339798 # Using graphillion
%o A339798 from graphillion import GraphSet
%o A339798 def make_CnXCk(n, k):
%o A339798     grids = []
%o A339798     for i in range(1, k + 1):
%o A339798         for j in range(1, n):
%o A339798             grids.append((i + (j - 1) * k, i + j * k))
%o A339798         grids.append((i + (n - 1) * k, i))
%o A339798     for i in range(1, k * n, k):
%o A339798         for j in range(1, k):
%o A339798             grids.append((i + j - 1, i + j))
%o A339798         grids.append((i + k - 1, i))
%o A339798     return grids
%o A339798 def A(start, goal, n, k):
%o A339798     universe = make_CnXCk(n, k)
%o A339798     GraphSet.set_universe(universe)
%o A339798     paths = GraphSet.paths(start, goal, is_hamilton=True)
%o A339798     return paths.len()
%o A339798 def B(n, k):
%o A339798     m = k * n
%o A339798     s = 0
%o A339798     for i in range(1, m):
%o A339798         for j in range(i + 1, m + 1):
%o A339798             s += A(i, j, n, k)
%o A339798     return s
%o A339798 def A339798(n):
%o A339798     return B(n, 4)
%o A339798 print([A339798(n) for n in range(3, 10)])
%Y A339798 Cf. A268838, A339797, A358868, A358870.
%Y A339798 Cf. A003695, A339796.
%K A339798 nonn
%O A339798 3,1
%A A339798 _Seiichi Manyama_, Dec 17 2020