[go: up one dir, main page]

login
A338961
Number of (undirected) paths in C_5 X P_n.
5
20, 1285, 39425, 971610, 21272810, 432363395, 8355404595
OFFSET
1,1
PROG
(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 B(n, k):
m = k * n
s = 0
for i in range(1, m):
for j in range(i + 1, m + 1):
s += A(i, j, n, k)
return s
def A338961(n):
return B(5, n)
print([A338961(n) for n in range(1, 6)])
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Seiichi Manyama, Dec 18 2020
STATUS
approved