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.

A339760 Number of (undirected) Hamiltonian paths in the 2 X n king graph.

This page as a plain text file.
%I A339760 #21 Feb 16 2025 08:34:01
%S A339760 1,12,48,208,768,2752,9472,32000,106496,351232,1150976,3756032,
%T A339760 12222464,39698432,128778240,417398784,1352138752,4378591232,
%U A339760 14175698944,45886734336,148520304640,480679821312,1555633799168,5034389536768,16292153131008,52723609239552,170619454881792,552140862914560
%N A339760 Number of (undirected) Hamiltonian paths in the 2 X n king graph.
%H A339760 Andrew Howroyd, <a href="/A339760/b339760.txt">Table of n, a(n) for n = 1..500</a> (terms 1..50 from Seiichi Manyama)
%H A339760 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/GraphPath.html">Graph Path</a>
%H A339760 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/KingGraph.html">King Graph</a>
%H A339760 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (6,-8,-8,16).
%F A339760 Empirical g.f.: x*(1 + 6*x - 16*x^2 + 24*x^3 - 16*x^4) / ((1 - 2*x)^2 * (1 - 2*x - 4*x^2)). - _Vaclav Kotesovec_, Dec 16 2020
%F A339760 The above formula is correct. - _Andrew Howroyd_, Jan 17 2022
%o A339760 (Python)
%o A339760 # Using graphillion
%o A339760 from graphillion import GraphSet
%o A339760 def make_nXk_king_graph(n, k):
%o A339760     grids = []
%o A339760     for i in range(1, k + 1):
%o A339760         for j in range(1, n):
%o A339760             grids.append((i + (j - 1) * k, i + j * k))
%o A339760             if i < k:
%o A339760                 grids.append((i + (j - 1) * k, i + j * k + 1))
%o A339760             if i > 1:
%o A339760                 grids.append((i + (j - 1) * k, i + j * k - 1))
%o A339760     for i in range(1, k * n, k):
%o A339760         for j in range(1, k):
%o A339760             grids.append((i + j - 1, i + j))
%o A339760     return grids
%o A339760 def A(start, goal, n, k):
%o A339760     universe = make_nXk_king_graph(n, k)
%o A339760     GraphSet.set_universe(universe)
%o A339760     paths = GraphSet.paths(start, goal, is_hamilton=True)
%o A339760     return paths.len()
%o A339760 def B(n, k):
%o A339760     m = k * n
%o A339760     s = 0
%o A339760     for i in range(1, m):
%o A339760         for j in range(i + 1, m + 1):
%o A339760             s += A(i, j, n, k)
%o A339760     return s
%o A339760 def A339760(n):
%o A339760     return B(n, 2)
%o A339760 print([A339760(n) for n in range(1, 21)])
%o A339760 (PARI) Vec((1 + 6*x - 16*x^2 + 24*x^3 - 16*x^4) / ((1 - 2*x)^2 * (1 - 2*x - 4*x^2)) + O(x^20)) \\ _Andrew Howroyd_, Jan 17 2022
%Y A339760 Row 2 of A350729.
%Y A339760 Cf. A308129, A339750, A339761, A339762, A339763.
%K A339760 nonn,easy
%O A339760 1,2
%A A339760 _Seiichi Manyama_, Dec 16 2020