A333759 Number of self-avoiding closed paths in the n X n grid graph which pass through all vertices on four (left, right, upper, lower) sides of the graph.
1, 1, 11, 191, 11346, 2002405, 1112939654, 1878223479450
Offset: 2
Examples
a(2) = 1; +--+ | | +--+ a(3) = 1; +--+--+ | | + + | | +--+--+ a(4) = 11; +--+--+--+ +--+--+--+ +--+--+--+ | | | | | | +--*--* + +--* *--+ +--* + | | | | | | +--*--* + +--* *--+ +--* + | | | | | | +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+--+--+ | | | | | | + *--*--+ + *--* + + *--+ | | | | | | | | + *--*--+ + * * + + *--+ | | | | | | | | +--+--+--+ +--+ +--+ +--+--+--+ +--+--+--+ +--+--+--+ +--+ +--+ | | | | | | | | + + + + + *--* + | | | | | | + *--* + + + + *--* + | | | | | | | | | | +--+ +--+ +--+--+--+ +--+ +--+ +--+ +--+ +--+ +--+ | | | | | | | | + *--* + + * * + | | | | | | + + + *--* + | | | | +--+--+--+ +--+--+--+
Programs
-
Python
# Using graphillion from graphillion import GraphSet import graphillion.tutorial as tl def A333759(n): universe = tl.grid(n - 1, n - 1) GraphSet.set_universe(universe) cycles = GraphSet.cycles() points = [i for i in range(1, n * n + 1) if i % n < 2 or ((i - 1) // n + 1) % n < 2] for i in points: cycles = cycles.including(i) return cycles.len() print([A333759(n) for n in range(2, 10)])
Comments