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.

A174579 Number of spanning trees in the n-triangular grid graph.

This page as a plain text file.
%I A174579 #39 Feb 16 2025 08:33:12
%S A174579 1,3,54,5292,2723220,7242690816,98719805835000,6861326937782575104,
%T A174579 2423821818614367091537296,4342290918217084382837760000000,
%U A174579 39389085041906366256386454778172877408,1807026244113880332171608161401397806958116864
%N A174579 Number of spanning trees in the n-triangular grid graph.
%C A174579 The n-triangular grid graph has n+1 rows with k vertices in row k. Each vertex is connected to the neighbors in the same row and up to two vertices in each of the neighboring rows. The Graph has A000217(n+1) vertices and 3*A000217(n) edges altogether.
%H A174579 Alois P. Heinz, <a href="/A174579/b174579.txt">Table of n, a(n) for n = 0..50</a>
%H A174579 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/SpanningTree.html">Spanning Tree</a>
%H A174579 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/TriangularGridGraph.html">Triangular Grid Graph</a>
%H A174579 Wikipedia, <a href="https://en.wikipedia.org/wiki/Kirchhoff%27s_theorem">Kirchhoff's theorem</a>
%p A174579 with(LinearAlgebra):
%p A174579 tr:= n-> n*(n+1)/2:
%p A174579 a:= proc(n) local h, i, M;
%p A174579       if n=0 then 1 else
%p A174579         M:= Matrix(tr(n+1), shape=symmetric);
%p A174579         for h in [seq(seq([[i, i+j], [i, i+j+1], [i+j, i+j+1]][],
%p A174579                            i=tr(j-1)+1 .. tr(j-1)+j), j=1..n)]
%p A174579         do M[h[]]:= -1 od;
%p A174579         for i to tr(n+1) do M[i, i]:= -add(M[i, j], j=1..tr(n+1)) od;
%p A174579         Determinant(DeleteColumn(DeleteRow(M, 1), 1))
%p A174579       fi
%p A174579     end:
%p A174579 seq(a(n), n=0..12);
%t A174579 tr[n_] := n*(n + 1)/2;
%t A174579 a[0] = 1; a[n_] := Module[{T, M}, T = Table[Table[{{i, i+j}, {i, i+j+1}, {i + j, i+j+1}}, {i, tr[j-1]+1, tr[j-1] + j}], {j, 1, n}] // Flatten[#, 2]&; M = Array[0&, {tr[n+1], tr[n+1]}]; Do[{i, j} = h; M[[i, j]] = -1, {h, T}]; M = M + Transpose[M]; For[i = 1, i <= tr[n+1], i++, M[[i, i]] = -Sum[M[[i, j]], {j, 1, tr[n+1]}]]; Det[Rest /@ Rest[M]]];
%t A174579 Table[a[n], {n, 0, 12}] (* _Jean-François Alcover_, Jun 02 2018, from Maple *)
%o A174579 (Python)
%o A174579 # Using graphillion
%o A174579 from graphillion import GraphSet
%o A174579 def make_n_triangular_grid_graph(n):
%o A174579     s = 1
%o A174579     grids = []
%o A174579     for i in range(n + 1, 1, -1):
%o A174579         for j in range(i - 1):
%o A174579             a, b, c = s + j, s + j + 1, s + i + j
%o A174579             grids.extend([(a, b), (a, c), (b, c)])
%o A174579         s += i
%o A174579     return grids
%o A174579 def A174579(n):
%o A174579     if n == 0: return 1
%o A174579     universe = make_n_triangular_grid_graph(n)
%o A174579     GraphSet.set_universe(universe)
%o A174579     spanning_trees = GraphSet.trees(is_spanning=True)
%o A174579     return spanning_trees.len()
%o A174579 print([A174579(n) for n in range(8)])  # _Seiichi Manyama_, Nov 30 2020
%Y A174579 Cf. A000217, A112676, A266513.
%K A174579 nonn
%O A174579 0,2
%A A174579 _Alois P. Heinz_, Nov 29 2010
%E A174579 Indexing changed by _Alois P. Heinz_, Jun 14 2017