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.

A333464 Number of self-avoiding walks from NW to SE corners on an n X n grid which pass through all points on the diagonal connecting NE and SW corners.

This page as a plain text file.
%I A333464 #32 Apr 07 2020 10:38:43
%S A333464 1,0,2,20,752,84008,29145982,30795358024,99417240957788
%N A333464 Number of self-avoiding walks from NW to SE corners on an n X n grid which pass through all points on the diagonal connecting NE and SW corners.
%C A333464 a(11) = 29262010991555584566654. - _Seiichi Manyama_, Apr 07 2020
%e A333464 a(3) = 2;
%e A333464    S--*--+   S  *--+
%e A333464          |   |  |  |
%e A333464    *--+--*   *  +  *
%e A333464    |         |  |  |
%e A333464    +--*--E   +--*  E
%e A333464 a(4) = 20;
%e A333464    S--*--*--+   S--*--*--+   S--*--*--+
%e A333464             |            |            |
%e A333464    *--*--+--*   *--*--+--*   *--*  +--*
%e A333464    |            |            |  |  |
%e A333464    *  +--*      *  +--*--*   *  +--*
%e A333464    |  |  |      |  |     |   |
%e A333464    +--*  *--E   +--*     E   +--*--*--E
%e A333464    S--*--*--+   S--*--*--+   S--*--*--+
%e A333464             |            |            |
%e A333464       *--+--*      *--+--*      *--+  *
%e A333464       |            |            |  |  |
%e A333464    *--+  *--*   *--+         *--+  *--*
%e A333464    |     |  |   |            |
%e A333464    +--*--*  E   +--*--*--E   +--*--*--E
%e A333464    S--*--*--+   S--*  *--+   S--*  *--+
%e A333464             |      |  |  |      |  |  |
%e A333464          +--*   *--*  +  *      *--+  *
%e A333464          |      |     |  |            |
%e A333464    *--+--*      *  +--*  *   *--+--*--*
%e A333464    |            |  |     |   |
%e A333464    +--*--*--E   +--*     E   +--*--*--E
%e A333464    S--*  *--+   S  *--*--+   S  *--*--+
%e A333464       |  |  |   |  |     |   |  |     |
%e A333464       *  +  *   *--*  +--*   *  *--+  *
%e A333464       |  |  |         |      |     |  |
%e A333464    *--+  *  *   *--+--*      *  +--*  *
%e A333464    |     |  |   |            |  |     |
%e A333464    +--*--*  E   +--*--*--E   +--*     E
%e A333464    S  *--*--+   S  *--*--+   S     *--+
%e A333464    |  |     |   |  |     |   |     |  |
%e A333464    *  *  +--*   *  *  +--*   *--*--+  *
%e A333464    |  |  |      |  |  |               |
%e A333464    *  +  *      *  +  *--*   *--+--*--*
%e A333464    |  |  |      |  |     |   |
%e A333464    +--*  *--E   +--*     E   +--*--*--E
%e A333464    S     *--+   S     *--+   S     *--+
%e A333464    |     |  |   |     |  |   |     |  |
%e A333464    *--*  +  *   *  *--+  *   *  *--+  *
%e A333464       |  |  |   |  |     |   |  |     |
%e A333464    *--+  *  *   *  +--*  *   *  +  *--*
%e A333464    |     |  |   |     |  |   |  |  |
%e A333464    +--*--*  E   +--*--*  E   +--*  *--E
%e A333464    S     *--+   S     *--+
%e A333464    |     |  |   |     |  |
%e A333464    *  *--+  *   *     +  *
%e A333464    |  |     |   |     |  |
%e A333464    *  +     *   *  +--*  *
%e A333464    |  |     |   |  |     |
%e A333464    +--*     E   +--*     E
%o A333464 (Python)
%o A333464 # Using graphillion
%o A333464 from graphillion import GraphSet
%o A333464 import graphillion.tutorial as tl
%o A333464 def A333464(n):
%o A333464     if n == 1: return 1
%o A333464     universe = tl.grid(n - 1, n - 1)
%o A333464     GraphSet.set_universe(universe)
%o A333464     start, goal = 1, n * n
%o A333464     paths = GraphSet.paths(start, goal)
%o A333464     for i in range(n):
%o A333464         paths = paths.including((n - 1) * (i + 1) + 1)
%o A333464     return paths.len()
%o A333464 print([A333464(n) for n in range(1, 10)])
%o A333464 (Ruby)
%o A333464 def search(x, y, n, used)
%o A333464   return 0 if x < 0 || n <= x || y < 0 || n <= y || used[x + y * n]
%o A333464   return 1 if x == n - 1 && y == n - 1 && (0..n - 1).all?{|i| used[(n - 1) * (i + 1)] == true}
%o A333464   cnt = 0
%o A333464   used[x + y * n] = true
%o A333464   @move.each{|mo|
%o A333464     cnt += search(x + mo[0], y + mo[1], n, used)
%o A333464   }
%o A333464   used[x + y * n] = false
%o A333464   cnt
%o A333464 end
%o A333464 def A(n)
%o A333464   return 1 if n == 1
%o A333464   @move = [[1, 0], [-1, 0], [0, 1], [0, -1]]
%o A333464   used = Array.new(n * n, false)
%o A333464   search(0, 0, n, used)
%o A333464 end
%o A333464 def A333464(n)
%o A333464   (1..n).map{|i| A(i)}
%o A333464 end
%o A333464 p A333464(6)
%Y A333464 Cf. A007764, A333455.
%K A333464 nonn,more
%O A333464 1,3
%A A333464 _Seiichi Manyama_, Mar 22 2020