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.

A338963 Number of (undirected) paths in C_n X P_n.

Original entry on oeis.org

1209, 103184, 21272810, 11481159930
Offset: 3

Views

Author

Seiichi Manyama, Dec 18 2020

Keywords

Comments

a(8) = 70244258770074672.

Crossrefs

Programs

  • Python
    # Using graphillion
    from graphillion import GraphSet
    def make_CnXPk(n, k):
        grids = []
        for i in range(1, k + 1):
            for j in range(1, n):
                grids.append((i + (j - 1) * k, i + j * k))
            grids.append((i + (n - 1) * k, i))
        for i in range(1, k * n, k):
            for j in range(1, k):
                grids.append((i + j - 1, i + j))
        return grids
    def A(start, goal, n, k):
        universe = make_CnXPk(n, k)
        GraphSet.set_universe(universe)
        paths = GraphSet.paths(start, goal)
        return paths.len()
    def A338963(n):
        m = n * n
        s = 0
        for i in range(1, m):
            for j in range(i + 1, m + 1):
                s += A(i, j, n, n)
        return s
    print([A338963(n) for n in range(3, 7)])