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-10 of 11 results. Next

A334877 Number of self-avoiding walks on a 2-dimensional square lattice where the walk consists of steps with incrementing length from 1 to n.

Original entry on oeis.org

1, 4, 12, 36, 108, 324, 948, 2740, 7892, 22540, 64020, 181396, 511828, 1440652, 4045676, 11322732, 31615780, 88100644, 245143676, 681002276, 1888943100, 5233741636, 14484853148, 40043579596, 110590828396, 305133547724
Offset: 0

Views

Author

Scott R. Shannon, May 13 2020

Keywords

Comments

This sequence gives the number of self-avoiding walks on a 2-dimensional square lattice where the walk starts with a step length of 1 which then increments by 1 after each step up until the step length is n.
The first time a collision with a previous step can occur is for n = 6. This can occur in three different ways. For example a walk with steps of length 1,2 and 3 to the right, a step of length 4 upward, then a step of length 5 to the left. A step of length 6 downward would now result in a collision. Requiring six steps before a collision is in contrast to the standard 2D square lattice SAW of A001411 where a collision can occur on the fourth step.
Note that this sequence agrees with a SAW on the diamond lattice, A001394, for the first 7 terms, even though the seventh term here has some walks removed due to the above collision.

Examples

			a(1) = 4. These are the four directions one can step away from a point on a 2D square lattice.
a(2) = 12. These consist of the two following walks:
.
    *
    |        1     2
    . 2    *---*---.---*
    |
*---*
  1
.
The first walk can be taken in 8 different ways, the second in 4 ways, giving a total of 12 walks.
a(3) = 36. These consist of the following five walks:
.
    *                                                           *
    |                                                           |
    .              3                     3                      .
    | 3      *---.---.---*         *---.---.---*                | 3
    .                    |         |                            .
    |                    . 2       . 2                          |
    *                    |         |                *---*---.---*
    |                *---*     *---*                  1     2
    . 2                1         1
    |                                     *---*---.---*---.---.---*
*---*                                       1     2          3
  1
.
The first four can be taken in 8 different ways, while the last straight walk can be taken in 4 ways, giving a total of 36 walks. Notice it is not possible to form a collision from any of these walks by adding a step of length 4.
		

Crossrefs

A380867 Numbers k such that one can make a rectangle from a chain of linked rods of length 1, 2, 3, ..., k, with perimeter equal to the total length.

Original entry on oeis.org

8, 15, 20, 24, 27, 32, 35, 39, 44, 48, 51, 55, 56, 63, 68, 75, 80, 84, 87, 92, 95, 99, 104, 111, 115, 116, 119, 120, 123, 124, 128, 132, 135, 140, 143, 144, 147, 152, 155, 159, 160, 164, 168, 171, 175, 176, 183, 184, 188, 195, 200, 203, 204, 207, 208, 212, 215, 216, 219, 220, 224, 231, 235, 236
Offset: 1

Views

Author

Ali Sada and M. F. Hasler, Mar 14 2025

Keywords

Comments

A more explicit description: Numbers n for which exist n1 > n2 > n3 > n4 >= 0 such that T(n) = 2*(A+B) with A = T(n1) - T(n2) = T(n3) - T(n4) and B = T(n2) - T(n3), where T = A000217.
If in the above solution {n1, ..., n4} we have n4 = 0, this means that the first and last rods (length 1 and n) meet in a corner. This first happens for n = 20 where we can have {0, 11, 14, 18} or {0, 5, 14, 15} with this property (and a third solution without this property).
If in such a solution we have two consecutive integers, e.g., n1 = n2 + 1, this means that one side of the rectangle is made of one single rod, here n1. (This happens in the second solution above with n1 = 15, and in the EXAMPLE n = 8, with n1 = 7.)

Examples

			The smallest such number is a(1) = 8, for which we have (n1..n4) = (2, 4, 6, 7), that is, the rectangle:
    o--+--o--o--+--+--+--+--+--+--+--o
    |  2   1             8           |
    |3                               |
    |                                |
    o                                7
    |                                |
    |4                               |
    |                                |
    |       5               6        |
    o--+--+--+--+--o--+--+--+--+--+--o
This is a special case of the 2-dimensional closed-loop self-avoiding paths on a square lattice considered in A334720.
		

Crossrefs

Cf. A000217 (triangular numbers), A334720 (2D cycles on square lattice).

Programs

  • PARI
    T(n)=n*(n+1)/2 /* = A000217 */
    select( {is_A380867(n)=my(Tn=T(n), T1, T2, T3, T4, n3, n4); Tn%2==0 && forstep(n1=n-1, 3, -1, T1=T(n1); forstep(n2=n1-1,2,-1, (B = Tn/2 - A = T1 - T2 = T(n2)) < 3 && break; iferr((1+n3=sqrtint(2*T3 = T2-B))*n3==2*T3 && (1+n4=sqrtint(2*T4 = T3-A))*n4==2*T4 && return(n), E,)))}, [1..99])

A380868 Number of distinct solutions {n1, n2, n3, n4} to the problem of forming a rectangle with sides made of linked rods of length 1, ..., n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 6, 0, 0, 0, 6, 0, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 3, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 0, 0, 0, 10, 0, 0, 3, 0, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0, 15
Offset: 1

Views

Author

M. F. Hasler, Mar 14 2025

Keywords

Comments

A solution to the problem is given by n1 > n2 > n3 > n4 >= 0 such that T(n) = 2*(A+B) with side lengths A = T(n1) - T(n2) = T(n3) - T(n4) and B = T(n2) - T(n3), where T = A000217.
When n4 = 0, this means that the rods of length 1 and n meet in a corner. When there are two consecutive n_k's (e.g. n1 = 7, n2 = 6 for n = 8) this means that one side is made of one single rod, of length equal to the larger of the two n_k's
Nonzero terms are at indices listed in A380867.
From Daniel Mondot, Mar 17 2025: (Start)
Conjecture 1: All terms are triangular numbers.
Conjecture 2: All triangular numbers will eventually appear in this sequence.(End)

Examples

			The only solution for n = 8 is depicted in A380867.
a(n = 20) = 3 is the first case where we have several distinct solutions,
 {5, 11, 15, 18}, {0, 11, 14, 18} and {0, 5, 14, 15}, The corresponding triangular numbers, whose differences give the side lengths, are {15, 66, 120, 171}, {0, 66, 105, 171} and {0, 15, 105, 120}.
		

Crossrefs

Cf. A000217 (triangular numbers), A334720 (2D cycles on square lattice).
Cf. A380867 (indices of nonzero terms).

Programs

  • PARI
    T(n)=n*(n+1)/2 \\ = A000217
    apply( {A380868(n)=my(Tn=T(n), T1, T2, T3, T4, n3, n4, cnt=0); Tn%2==0 && forstep(n1=n-1, 3, -1, T1=T(n1); forstep(n2=n1-1, 2, -1, (B = Tn/2 - A = T1 - T2 = T(n2)) < 3 && break; iferr((1+n3=sqrtint(2*T3 = T2-B))*n3==2*T3 && (1+n4=sqrtint(2*T4 = T3-A))*n4==2*T4 && cnt++, E, ))); cnt}, [1..99])

A334602 Number of self-avoiding walks on a 2-dimensional square lattice where the walk consists of steps of length 1 to n which can be taken in any order.

Original entry on oeis.org

1, 4, 24, 216, 2544, 36832, 632736, 12566016, 283849872, 7179191888, 200946557168, 6165203252096
Offset: 0

Views

Author

Scott R. Shannon, May 07 2020

Keywords

Comments

This sequence gives the number of self-avoiding walks on a 2-dimensional square lattice where the walk consists of steps of length 1 to n which can be taken in any order. Walks which visit the same lattice coordinates but are done so by taking steps of the same length in different order are considered to be different walks. For example a walk consisting of steps with length 1 and 2 to the right is counted as a different walk to one with step lengths 2 and 1 to the right.
The first time a collision with a previous step can occur is for n = 4. If we only consider the first step being taken to the right then there are six ways this can occur. These are 2R->3U->1L->4D, 3R->1U->2L->4D, 3R->2U->1L->4D, 4R->1U->2L->3D, 4R->1U->3L->2D, 4R->2U->1L->3D, where the number is the step length and R,L,U,D are directions right,left,up and down from the origin.

Examples

			a(1) = 4. These are the four directions one can step 1 unit away from the origin on a 2D square lattice.
a(2) = 24. These consist of the following four walks:
.
    *
    |             *        1     2            2     1
    . 2           | 1    *---*---.---*    *---.---*---*
    |     *---.---*
*---*         2
  1
.
The first two can be walked in eight different ways on a 2D lattice, the last two in four different ways, giving a total of 2*8+2*4 = 24.
a(3) = 216. Restricting the first step to the right then the different ways a walk can take three steps on a 2D lattice within the first quadrant are RUL, RUU, RUR, RRU, RRR. Each of these can be taken in 6 ways, the arrangements of 1,2,3. The first four walks can also be taken in eight ways on the 2D lattice, the last in four ways, giving a total of 4*8*3!+1*4*3! = 216.
a(4) = 2544. Restricting the first step to the right then the different ways a walk can take four steps on a 2D lattice within the first quadrant are RULD, RULL, RULU, RUUL, RUUU, RUUR, RURU, RURR, RURD, RRUL, RRUU, RRUR, RRRU, RRRR. Each of these can be taken in 24 ways, the arrangements of 1,2,3,4. However six of these walks are forbidden due to the collisions given in the comments. The first thirteen walks can also be taken in eight ways on the 2D lattice, the fourteenth in four ways. This gives a total number of walks of 13*8*4! - 6*8 + 4*4! = 2544.
		

Crossrefs

A335305 Number of 2-dimensional closed-loop self-avoiding paths on a square lattice where each path consists of steps of length 1 to n which can be taken in any order.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 16128, 287232, 0, 0, 1843367680, 45589291776, 0, 0
Offset: 1

Views

Author

Scott R. Shannon, May 31 2020

Keywords

Comments

This sequence gives the number of closed-loop self avoiding walks on a 2D square lattice where the walk consists of steps of length 1 to n which can be taken in any order. No closed-loop path is possible until n = 7.
As in A334720 the only n values which can form closed loops are those which correspond to even triangular numbers; any path must take the same number of steps back toward the origin as it does away from the origin in each of the four possible directions to form a closed loop, so the total sum of the steps in these directions must be even. As the walks consist of the steps of length 1 to n this implies only walks for which the sum of 1 to n is even can form closed loops.
Like A010566 all possible paths are counted, including those that are equivalent via rotation and reflection. Also counted as different walks are loops which visit identical lattice points but are done so by taking steps in a different order. This leads to an extremely rapid increase in the total number of loops possible as n increases.
a(15) is currently unknown but is likely to be about 6*10^15.

Examples

			a(1) to a(6) = 0 as no closed loop paths are possible.
a(7) = 16128. Given the first step has length 1 and is to the right, with the next non-right step being upward, there are 84 different loops. Each of these can be walked in at least 2 ways, with the single perfect square having 48 different possible walks. Each of these in turn can be started with a first step of length 1 to n, and each of these can then be walked in 8 different ways on a 2D square grid. This gives a total number of 7-step paths of 16128. This should be compared with A334720 where for n=7 only 8 paths are possible. See the attached link text file for more details of n=7.
		

Crossrefs

A336262 Number of self-avoiding walks on a 2-dimensional square lattice where the walk consists of steps with incrementing lengths equal to the prime numbers, from 2 to prime(n).

Original entry on oeis.org

1, 4, 12, 36, 108, 324, 972, 2876, 8364, 24124, 69116, 196916, 559604, 1585764, 4495740, 12714796, 35654620, 99686708, 278880060, 781504972, 2180418716, 6079373324, 16857930068, 46773551052, 129562831140, 358157148332
Offset: 0

Views

Author

Scott R. Shannon, Jul 15 2020

Keywords

Comments

The first time a collision with a previous step can occur is for n = 7, i.e., a walk with steps of length 2,3,5,7,11,13,17. If we consider only walks starting with one or more steps to the right followed by an upward step then a collision can occur in five ways. These are 2R->3U->5U->7U->11R->13D->17L, 2R->3U->5U->7U->11L->13D->17R, 2R->3U->5R->7R->11U->13L->17D, 2R->3U->5R->7R->11D->13L->17U, 2R->3R->5R->7R->11U->13L->17D, where the number is the step length and R,L,U,D are directions right,left,up and down on the grid. Requiring seven steps before a collision can occur is in contrast to the walk where the steps' lengths increment by 1, see A334877, which requires only six steps.

Examples

			a(1) = 4. These are the four ways one can step away from the origin on a 2D square lattice.
a(2) = 12. These consist of the two following walks:
.
        *
        |
        .
        | 3        2         3
        .      *---.---*---.---.---*
        |
*---.---*
     2
.
The first walk can be taken in eight different ways on the 2D square lattice, the second in four ways, giving a total of 12 walks.
a(7) = 2876. If we consider only walks starting with one or more steps to the right followed by an upward step, and ignoring collisions, then the total number of walks is 3^5+3^4+3^3+3^2+3^1+3^0 = 364. However, five of these are forbidden due to the collisions given in the comments, leaving 359 in total. These can be walked in eight different ways on the 2D grid. There are also the four straight walks along the axes. This gives a total of 359*8+4 = 2876 walks.
		

Crossrefs

A337550 Number of closed-loop self-avoiding paths of length 4n on a 2D square lattice where no step can be in the same direction as the previous step.

Original entry on oeis.org

8, 0, 24, 64, 360, 1728, 8624, 43776, 225216, 1173280, 6182704, 32905536, 176657000, 955629920, 5204178360, 28509374976, 157005901896, 868756900608, 4827586102216, 26929911745600, 150750954809952, 846588050093632, 4768197762850608
Offset: 1

Views

Author

Scott R. Shannon, Aug 31 2020

Keywords

Comments

See A337353 for the corresponding number of walks.
Only walks with a length of 4n (except for n=2) can create closed loops.
From Pontus von Brömssen, May 06 2025: (Start)
A006782 counts the walks up to starting point and direction of the walk.
A156228 counts the walks up to rotations, reflections, starting point, and direction of the walk.
(End)

Examples

			a(1) = 8. The single walk of length 4 is:
.
+---+
|   |
+---+
.
This can be taken in 8 different ways on a square lattice, giving a total 1*8 = 8.
a(2) = 0 as there is no closed-loop path consisting of 8 steps.
a(3) = 24. There is one walk, ignoring reflection and rotations, with a length of 12. The walk is:
.
    +---+
    |   |
+---+   +---+
|           |
+---+   +---+
    |   |
    +---+
.
This can be walked in 3 different ways if the first steps are right and then upward. This path can be then taken in 8 ways on a square lattice, giving a total number of 3*8 = 24.
a(4) = 64. There is one walk, with indistinct reflections and rotations, with a length of 16. The walk is:
.
        +---+
        |   |
    +---+   +---+
    |           |
+---+       +---+
|           |
+---+   +---+
    |   |
    +---+
.
This can be walked in 8 different ways if the first steps are right and then upward. This path can be then taken in 8 ways on a square lattice, giving a total number of 8*8 = 64.
.
a(5) = 360. There are four walks, with indistinct reflections and rotations, with a length of 20. The walks, and the different ways they can be taken, are:
.
            +---+              +---+
            |   |              |   |
        +---+   +---+      +---+   +---+
        |           |      |           |
    +---+       +---+      +---+       +---+
    |           |              |           |
+---+       +---+          +---+       +---+
|           |              |           |
+---+   +---+              +---+   +---+
    |   |     x 10             |   |     x 20
    +---+                      +---+
        +---+                  +---+
        |   |                  |   |
    +---+   +---+          +---+   +---+
    |           |          |           |
+---+           +---+      +---+   +---+
|                   |          |   |
+---+           +---+      +---+   +---+
    |           |          |           |
    +---+   +---+          +---+   +---+
        |   |    x 5           |   |     x 10
        +---+                  +---+
.
Each of these can be walked in 8 different ways on a square lattice, giving a total number of 8*(10+20+5+10) = 360.
See the attached text file for images of the closed-loops for n=1 to n=11.
		

Crossrefs

Formula

a(n) = 8*n*A006782(n). - Pontus von Brömssen, May 06 2025

Extensions

a(18)-a(19) from Bert Dobbelaere, Sep 09 2020
a(20)-a(23) (using A006782 data) from Pontus von Brömssen, May 06 2025

A336265 Number of 2D closed-loop self-avoiding paths on a square lattice where each path consists of steps with successive lengths equal to the prime numbers, from 2 to prime(2n+1).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 56, 64, 448, 1552, 8952, 65120, 284584, 1491800, 8467816, 48961856, 307751136, 1781258728
Offset: 0

Views

Author

Scott R. Shannon, Jul 15 2020

Keywords

Comments

This sequence gives the number of closed-loop self avoiding walks on a 2D square lattice where the walk consists of steps with successive lengths equal to the prime numbers. No closed loop path is possible until n = 6, i.e. prime(13) = 41. This walk consists of steps of length 2,3,5,7,11,13,17,19,23,29,31,37,41.
Similar to A010566, where only an even number of steps can form a closed loop, here only an odd number can. This is due to the requirement that the total distance stepped in each of the four directions away from the origin must be matched by an equal distance in the opposite direction. As all primes, other than 2, are odd and unique, this can only occur if the total number of steps in a given direction (other than the direction of the first step of length 2) is even. However the first single step of length 2 still requires an even number of odd length steps to return to the origin, giving an odd number of steps overall in that direction. Adding up the four directions gives an overall odd number for the total number of steps.

Examples

			a(0) to a(5) = 0 as no closed-loop walk is possible.
a(6) = 56. There are seven walks which form closed loops when considering only those which start with one or more steps to the right followed by a step upward. These walks consist of steps with lengths 2,3,5,7,11,13,17,19,23,29,31,37,41. See the attached linked text file for the images. Each of these can be walked in eight ways on a 2D square lattice, giving a total number of closed loops of 7*8 = 56.
See the attached linked text files for images of n = 7 and n = 8.
		

Crossrefs

A342800 Number of self-avoiding polygons on a 3-dimensional cubic lattice where each walk consists of steps with incrementing length from 1 to n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 24, 72, 0, 0, 1704, 5184, 0, 0, 193344, 600504, 0, 0, 34321512, 141520752, 0, 0, 9205815672, 37962945288, 0, 0
Offset: 1

Views

Author

Scott R. Shannon, Mar 21 2021

Keywords

Comments

This sequence gives the number of self-avoiding polygons (closed-loop self-avoiding walks) on a 3D cubic lattice where the walk starts with a step length of 1 which then increments by 1 after each step up until the step length is n. Like A334720 and A335305 only n values corresponding to even triangular numbers can form closed loops. All possible paths are counted, including those that are equivalent via rotation and reflection.

Examples

			a(1) to a(6) = 0 as no self-avoiding closed-loop walk is possible.
a(7) = 24 as there is one walk which forms a closed loop which can be walked in 24 different ways on a 3D cubic lattice. These walks, and those for n(8) = 72, are purely 2-dimensional. See A334720 for images of these walks.
a(11) = 1704. These walks consist of 120 purely 2-dimensional walks and 1584 3-dimensional walks. One of these 3-dimensional walks is:
.
                                /|
                               / |                        z  y
                              /  |                        | /
                        7 +y /   |                        |/
                            /    | 8 -z                   |----- x
             6 +x          /     |
  |---.---.---.---.---.---/      |               9 +x
  |                              |---.---.---.---.---.---.---.---.---/
  | 5 +z                                                            /
  |                                                                /
  |---.---.---.---/                                               /
        4 -x     /  3 +y                                         /
                /                                               /  10 -y
                | 2 +z                                         /
                |                                             /
                | 1 +z                                       /
                X---.---.---.---.---.---.---.---.---.---.---/
                                     11 -x
.
		

Crossrefs

A345676 Number of closed-loop self-avoiding paths on a 2-dimensional square lattice where each path consists of steps with successive lengths equal to the square numbers, from 1 to n^2.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 368, 264, 0, 0, 1656, 5104, 0, 0, 62016, 105344, 0, 0, 1046656, 3181104
Offset: 1

Views

Author

Scott R. Shannon, Sep 04 2021

Keywords

Comments

This sequence gives the number of closed-loop self-avoiding walks on a 2D square lattice where the walk starts with a step length of 1 which then increments at each step to the next square number until the step length is n^2. No closed-loop path is possible until n = 15.
Like A334720 and A335305 the only n values that can form closed loop walks are those which correspond to the indices of even triangular numbers. Curiously though n = 16 walks form no closed loops, even though both n = 15 and n = 16 are indices of such numbers.
As in A010566 all possible paths are counted, including those that are equivalent via rotation and reflection.

Examples

			a(1) to a(14) = 0 as no closed-loop paths are possible.
a(15) = 32 as there are four different paths which form closed loops, and each of these can be walked in eight different ways on a 2D square lattice. These walks consist of steps with lengths 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225. See the linked text images.
		

Crossrefs

Showing 1-10 of 11 results. Next