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.

Original entry on oeis.org

1, 3, 54, 5292, 2723220, 7242690816, 98719805835000, 6861326937782575104, 2423821818614367091537296, 4342290918217084382837760000000, 39389085041906366256386454778172877408, 1807026244113880332171608161401397806958116864
Offset: 0

Views

Author

Alois P. Heinz, Nov 29 2010

Keywords

Comments

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.

Crossrefs

Programs

  • Maple
    with(LinearAlgebra):
    tr:= n-> n*(n+1)/2:
    a:= proc(n) local h, i, M;
          if n=0 then 1 else
            M:= Matrix(tr(n+1), shape=symmetric);
            for h in [seq(seq([[i, i+j], [i, i+j+1], [i+j, i+j+1]][],
                               i=tr(j-1)+1 .. tr(j-1)+j), j=1..n)]
            do M[h[]]:= -1 od;
            for i to tr(n+1) do M[i, i]:= -add(M[i, j], j=1..tr(n+1)) od;
            Determinant(DeleteColumn(DeleteRow(M, 1), 1))
          fi
        end:
    seq(a(n), n=0..12);
  • Mathematica
    tr[n_] := n*(n + 1)/2;
    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]]];
    Table[a[n], {n, 0, 12}] (* Jean-François Alcover, Jun 02 2018, from Maple *)
  • Python
    # Using graphillion
    from graphillion import GraphSet
    def make_n_triangular_grid_graph(n):
        s = 1
        grids = []
        for i in range(n + 1, 1, -1):
            for j in range(i - 1):
                a, b, c = s + j, s + j + 1, s + i + j
                grids.extend([(a, b), (a, c), (b, c)])
            s += i
        return grids
    def A174579(n):
        if n == 0: return 1
        universe = make_n_triangular_grid_graph(n)
        GraphSet.set_universe(universe)
        spanning_trees = GraphSet.trees(is_spanning=True)
        return spanning_trees.len()
    print([A174579(n) for n in range(8)])  # Seiichi Manyama, Nov 30 2020

Extensions

Indexing changed by Alois P. Heinz, Jun 14 2017