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.

Showing 1-2 of 2 results.

A322419 Number of n-step self-avoiding walks on L-lattice.

Original entry on oeis.org

1, 2, 4, 8, 12, 20, 32, 52, 84, 136, 220, 356, 564, 904, 1448, 2320, 3684, 5872, 9376, 14960, 23688, 37652, 59912, 95316, 150744, 239080, 379528, 602424, 951788, 1507136, 2388252, 3784344, 5973988, 9447880, 14950796, 23658540, 37321752, 58965260, 93206864, 147333080, 232286272
Offset: 0

Views

Author

Robert FERREOL, Dec 07 2018

Keywords

Comments

The L-lattice is an oriented square lattice in which each step must be followed by a step perpendicular to the preceding one.

Examples

			a(1) = 2 because there are only two possible directions at each intersection; for the same reason a(2) = 2*2 and a(3) = 2*4 ; but a(4) = 12 (not 16) because four paths return to the starting point and are not self-avoiding. See the 12 paths under "links".
		

Crossrefs

Cf. A001411 (square lattice), A117633 (Manhattan lattice), A189722, A004277 (coordination sequence), A151798.

Programs

  • Maple
    walks:=proc(n)
        option remember;
        local i,father,End,X,walkN,dir,u,x,y;
        if n=1 then [[[0,0]]] else
             father:=walks(n-1):
             walkN:=NULL:
             for i to nops(father) do
                u:=father[i]:End:=u[n-1]:if n mod 2 = 0 then
                dir:=[[1,0], [-1, 0]] else dir := [[0,1], [0, -1]] fi:
                for X in dir do
                 if not(member(End+X,u)) then walkN:=walkN,[op(u),End+X] fi;
                 od od:
             [walkN] fi end:
    n:=5:L:=walks(n):N:=nops(L);
    # This program explicitly gives the a(n) walks.
  • Mathematica
    mo = {{1, 0}, {-1, 0}}; moo = {{0, 1}, {0, -1}}; a[0] = 1;
    a[tg_, p_: {{0, 0}}] := Module[{e, mv},
    If[Mod[tg, 2] == 0, mv = Complement[Last[p] + # & /@ mo, p],
    mv = Complement[Last[p] + # & /@ moo, p]];
    If[tg == 1, Length@mv, Sum[a[tg - 1, Append[p, e]], {e, mv}]]];
    a /@ Range[0, 20] (* after the program from Giovanni Resta at A001411 *)
  • Python
    def add(L, x):
        M = [y for y in L]
        M.append(x)
        return M
    plus = lambda L, M: [x + y for x, y in zip(L, M)]
    mo = [[1, 0], [-1, 0]]
    moo = [[0, 1], [0, -1]]
    def a(n, P=[[0, 0]]):
        if n == 0:
            return 1
        if n % 2 == 0:
            mv1 = [plus(P[-1], x) for x in mo]
        else:
            mv1 = [plus(P[-1], x) for x in moo]
        mv2 = [x for x in mv1 if x not in P]
        if n == 1:
            return len(mv2)
        else:
            return sum(a(n - 1, add(P, x)) for x in mv2)
    [a(n) for n in range(21)]

Formula

a(n) = 4*A189722(n) for n >= 2.
It is proved that a(n)^(1/n) has a limit mu called the "connective constant" of the L-lattice; approximate value of mu: 1.5657. It is only conjectured that a(n + 1) ~ mu * a(n).

A293865 Number of self-intersecting walks of length n on a square lattice such that at each point the angle turns 90 degrees.

Original entry on oeis.org

0, 0, 0, 1, 1, 2, 3, 5, 8, 13, 21, 37, 56, 90, 144, 239, 374, 592, 948, 1558, 2431, 3848, 6127, 9972, 15602, 24658, 39158, 63265, 99110, 156505, 248040, 398675, 625024, 986241, 1560763, 2498832, 3919561, 6180914, 9770162, 15594972, 24470070, 38567903, 60907330
Offset: 1

Views

Author

Jens Randrup Rasmussen, Oct 18 2017

Keywords

Comments

It is assumed that the first walk turns left and that all walks end when they intersect themselves.

Examples

			For n = 4 we have the simplest self-intersecting walk, which is a square.
For n = 5 we have the walk:
(0,0), (0,1), (-1,1), (-1, 2), (0,2), (0,1)
For n = 6 we have the walks:
(0,0), (0,1), (-1,1), (-1, 0), (-2,0), (-2,1), (-1,1)
(0,0), (0,1), (-1,1), (-1, 2), (-2,2), (-2,1), (-1,1)
		

Crossrefs

This sequence gives the number of self-intersecting walks while A189722 gives the number of self-avoiding walks.

Formula

For n>2, a(n) = 2*A189722(n-1) - A189722(n). - Jens Randrup Rasmussen, Oct 29 2017

Extensions

The terms starting from a(11) and the program corrected by Jens Randrup Rasmussen, Oct 29 2017
Showing 1-2 of 2 results.