A333466
Number of self-avoiding closed paths on an n X n grid which pass through four corners ((0,0), (0,n-1), (n-1,n-1), (n-1,0)).
Original entry on oeis.org
1, 1, 11, 373, 44930, 17720400, 22013629316, 84579095455492
Offset: 2
a(2) = 1;
+--+
| |
+--+
a(3) = 1;
+--*--+
| |
* *
| |
+--*--+
a(4) = 11;
+--*--*--+ +--*--*--+ +--*--*--+
| | | | | |
*--*--* * *--* *--* *--* *
| | | | | |
*--*--* * *--* *--* *--* *
| | | | | |
+--*--*--+ +--*--*--+ +--*--*--+
+--*--*--+ +--*--*--+ +--*--*--+
| | | | | |
* *--*--* * *--* * * *--*
| | | | | | | |
* *--*--* * * * * * *--*
| | | | | | | |
+--*--*--+ +--* *--+ +--*--*--+
+--*--*--+ +--*--*--+ +--* *--+
| | | | | | | |
* * * * * *--* *
| | | | | |
* *--* * * * * *--* *
| | | | | | | | | |
+--* *--+ +--*--*--+ +--* *--+
+--* *--+ +--* *--+
| | | | | | | |
* *--* * * * * *
| | | | | |
* * * *--* *
| | | |
+--*--*--+ +--*--*--+
-
# Using graphillion
from graphillion import GraphSet
import graphillion.tutorial as tl
def A333466(n):
universe = tl.grid(n - 1, n - 1)
GraphSet.set_universe(universe)
cycles = GraphSet.cycles()
for i in [1, n, n * (n - 1) + 1, n * n]:
cycles = cycles.including(i)
return cycles.len()
print([A333466(n) for n in range(2, 10)])
-
def search(x, y, n, used)
return 0 if x < 0 || n <= x || y < 0 || n <= y || used[x + y * n]
return 1 if x == 0 && y == 1 && [n - 1, n * (n - 1), n * n - 1].all?{|i| used[i] == true}
cnt = 0
used[x + y * n] = true
@move.each{|mo|
cnt += search(x + mo[0], y + mo[1], n, used)
}
used[x + y * n] = false
cnt
end
def A(n)
return 1 if n < 3
@move = [[1, 0], [-1, 0], [0, 1], [0, -1]]
used = Array.new(n * n, false)
search(0, 0, n, used)
end
def A333466(n)
(2..n).map{|i| A(i)}
end
p A333466(6)
A333758
Square array T(n,k), n >= 2, k >= 2, read by antidiagonals, where T(n,k) is the number of self-avoiding closed paths in the n X k grid graph which pass through all vertices on four (left, right, upper, lower) sides of the graph.
Original entry on oeis.org
1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 5, 11, 5, 1, 1, 11, 36, 36, 11, 1, 1, 21, 122, 191, 122, 21, 1, 1, 43, 408, 1123, 1123, 408, 43, 1, 1, 85, 1371, 6410, 11346, 6410, 1371, 85, 1, 1, 171, 4599, 37165, 113748, 113748, 37165, 4599, 171, 1
Offset: 2
T(4,3) = 3;
+--+--+ +--+--+ +--+--+
| | | | | |
+--* + + *--+ + +
| | | | | |
+--* + + *--+ + +
| | | | | |
+--+--+ +--+--+ +--+--+
Square array T(n,k) begins:
1, 1, 1, 1, 1, 1, 1, ...
1, 1, 3, 5, 11, 21, 43, ...
1, 3, 11, 36, 122, 408, 1371, ...
1, 5, 36, 191, 1123, 6410, 37165, ...
1, 11, 122, 1123, 11346, 113748, 1153742, ...
1, 21, 408, 6410, 113748, 2002405, 35669433, ...
-
# Using graphillion
from graphillion import GraphSet
import graphillion.tutorial as tl
def A333758(n, k):
universe = tl.grid(n - 1, k - 1)
GraphSet.set_universe(universe)
cycles = GraphSet.cycles()
points = [i for i in range(1, k * n + 1) if i % k < 2 or ((i - 1) // k + 1) % n < 2]
for i in points:
cycles = cycles.including(i)
return cycles.len()
print([A333758(j + 2, i - j + 2) for i in range(11 - 1) for j in range(i + 1)])
A333515
Number of self-avoiding closed paths on an n X 5 grid which pass through four corners ((0,0), (0,4), (n-1,4), (n-1,0)).
Original entry on oeis.org
1, 7, 49, 373, 3105, 26515, 227441, 1953099, 16782957, 144262743, 1240194297, 10662034451, 91663230249, 788046822891, 6775004473757, 58246174168047, 500755017859261, 4305100014182879, 37011883913816129, 318199242452585915, 2735628331213604009, 23518793814422304163
Offset: 2
a(2) = 1;
+--*--*--*--+
| |
+--*--*--*--+
a(3) = 7;
+--*--*--*--+ +--*--*--*--+ +--*--*--*--+
| | | | | |
* *--* * * *--*--* * * *--* *
| | | | | | | | | | | |
+--*--* *--+ +--* *--+ +--* *--*--+
+--*--*--*--+ +--*--* *--+ +--* *--*--+
| | | | | | | | | |
* * * *--* * * *--* *
| | | | | |
+--*--*--*--+ +--*--*--*--+ +--*--*--*--+
+--* *--+
| | | |
* *--*--* *
| |
+--*--*--*--+
-
# Using graphillion
from graphillion import GraphSet
import graphillion.tutorial as tl
def A333513(n, k):
universe = tl.grid(n - 1, k - 1)
GraphSet.set_universe(universe)
cycles = GraphSet.cycles()
for i in [1, k, k * (n - 1) + 1, k * n]:
cycles = cycles.including(i)
return cycles.len()
def A333515(n):
return A333513(n, 5)
print([A333515(n) for n in range(2, 25)])
A333514
Number of self-avoiding closed paths on an n X 4 grid which pass through four corners ((0,0), (0,3), (n-1,3), (n-1,0)).
Original entry on oeis.org
1, 3, 11, 49, 229, 1081, 5123, 24323, 115567, 549253, 2610697, 12409597, 58988239, 280398495, 1332867179, 6335755801, 30116890013, 143160058769, 680508623307, 3234784886251, 15376488953815, 73091850448509, 347440733910081, 1651552982759797, 7850625988903223
Offset: 2
a(2) = 1;
+--*--*--+
| |
+--*--*--+
a(3) = 3;
+--*--*--+ +--*--*--+ +--* *--+
| | | | | | | |
* *--* * * * * *--* *
| | | | | | | |
+--* *--+ +--*--*--+ +--*--*--+
a(4) = 11;
+--*--*--+ +--*--*--+ +--*--*--+
| | | | | |
*--*--* * *--* *--* *--* *
| | | | | |
*--*--* * *--* *--* *--* *
| | | | | |
+--*--*--+ +--*--*--+ +--*--*--+
+--*--*--+ +--*--*--+ +--*--*--+
| | | | | |
* *--*--* * *--* * * *--*
| | | | | | | |
* *--*--* * * * * * *--*
| | | | | | | |
+--*--*--+ +--* *--+ +--*--*--+
+--*--*--+ +--*--*--+ +--* *--+
| | | | | | | |
* * * * * *--* *
| | | | | |
* *--* * * * * *--* *
| | | | | | | | | |
+--* *--+ +--*--*--+ +--* *--+
+--* *--+ +--* *--+
| | | | | | | |
* *--* * * * * *
| | | | | |
* * * *--* *
| | | |
+--*--*--+ +--*--*--+
-
N=40; x='x+O('x^N); Vec(x^2*(1-4*x+2*x^2+x^3)/(1-7*x+12*x^2-7*x^3+3*x^4+2*x^5))
-
# Using graphillion
from graphillion import GraphSet
import graphillion.tutorial as tl
def A333513(n, k):
universe = tl.grid(n - 1, k - 1)
GraphSet.set_universe(universe)
cycles = GraphSet.cycles()
for i in [1, k, k * (n - 1) + 1, k * n]:
cycles = cycles.including(i)
return cycles.len()
def A333514(n):
return A333513(4, n)
print([A333514(n) for n in range(2, 15)])
A358713
Number of self-avoiding closed paths on an n X 7 grid which pass through four corners ((0,0), (0,6), (n-1,6), (n-1,0)).
Original entry on oeis.org
1, 41, 1081, 26515, 674292, 17720400, 471468756, 12570253556, 335101401877, 8932110760401, 238088717357193, 6346541968642151, 169176879483125528, 4509681115981777876, 120212775466066851264, 3204464007623702644476, 85420126381414152110475, 2277010595175522782497635
Offset: 2
A358712
Number of self-avoiding closed paths on an n X 6 grid which pass through four corners ((0,0), (0,5), (n-1,5), (n-1,0)).
Original entry on oeis.org
1, 17, 229, 3105, 44930, 674292, 10217420, 154980130, 2350703747, 35658264301, 540957030465, 8206939419403
Offset: 2
Showing 1-6 of 6 results.
Comments