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 10 results.

A217015 Permutation of natural numbers arising from applying the walk of a square spiral (e.g. A214526) to the data of rotated-square spiral (defined in A215468).

Original entry on oeis.org

1, 5, 6, 2, 8, 3, 10, 4, 12, 24, 13, 14, 27, 15, 7, 17, 31, 18, 9, 20, 35, 21, 11, 23, 39, 59, 40, 25, 26, 43, 64, 44, 28, 16, 30, 48, 70, 49, 32, 19, 34, 53, 76, 54, 36, 22, 38, 58, 82, 110, 83, 60, 41, 42, 63, 88, 117, 89, 65, 45, 29, 47, 69, 95, 125, 96, 71, 50
Offset: 1

Views

Author

Alex Ratushnyak, Sep 23 2012

Keywords

Crossrefs

Programs

  • Python
    SIZE = 33       # must be 4k+1
    grid = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid[posY*SIZE+posX]=1
    posX += 1
    grid[posY*SIZE+posX]=2
    n = 3
    def walk(stepX, stepY, chkX, chkY):
      global posX, posY, n
      while 1:
        posX+=stepX
        posY+=stepY
        grid[posY*SIZE+posX]=n
        n+=1
        if grid[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while posX!=SIZE-1:
        walk(-1,  1, -1, -1)    # down-left
        walk(-1, -1,  1, -1)    # up-left
        walk( 1, -1,  1,  0)    # up-right
        walk( 1,  0,  1,  1)    # right
        walk( 1,  1, -1,  1)    # down-right
    import sys
    grid2 = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid2[posY*SIZE+posX]=1
    def walk2(stepX, stepY, chkX, chkY):
      global posX, posY
      while 1:
        a = grid[posY*SIZE+posX]
        if a==0:
            sys.exit(1)
        print(a, end=', ')
        posX+=stepX
        posY+=stepY
        grid2[posY*SIZE+posX]=1
        if grid2[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while 1:
        walk2(0, -1, 1, 0)    # up
        walk2(1, 0, 0, 1)     # right
        walk2(0, 1, -1, 0)    # down
        walk2(-1, 0, 0, -1)   # left

A217011 Permutation of natural numbers arising from applying the walk of a square spiral (e.g. A214526) to the data of right triangular type-2 spiral (defined in A214251).

Original entry on oeis.org

1, 5, 19, 6, 8, 9, 10, 2, 3, 4, 18, 41, 73, 42, 20, 7, 24, 25, 26, 27, 28, 11, 12, 13, 14, 15, 17, 40, 72, 113, 163, 114, 74, 43, 21, 23, 49, 50, 51, 52, 53, 54, 55, 29, 30, 31, 32, 33, 34, 35, 16, 39, 71, 112, 162, 221
Offset: 1

Views

Author

Alex Ratushnyak, Sep 23 2012

Keywords

Crossrefs

Programs

  • Python
    SIZE = 33       # must be 4k+1
    grid = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid[posY*SIZE+posX]=1
    n = 2
    def walk(stepX, stepY, chkX, chkY):
      global posX, posY, n
      while 1:
        posX+=stepX
        posY+=stepY
        grid[posY*SIZE+posX]=n
        n+=1
        if grid[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while 1:
        walk(-1, 0,  0, -1)    # left
        walk(0, -1,  1,  1)    # up
        if posY==0:
            break
        walk( 1, 1, -1,  0)    # right-down
    import sys
    grid2 = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid2[posY*SIZE+posX]=1
    def walk2(stepX, stepY, chkX, chkY):
      global posX, posY
      while 1:
        a = grid[posY*SIZE+posX]
        if a==0:
            sys.exit(1)
        print(a, end=', ')
        posX+=stepX
        posY+=stepY
        grid2[posY*SIZE+posX]=1
        if grid2[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while 1:
        walk2(0, -1, 1, 0)    # up
        walk2(1, 0, 0, 1)     # right
        walk2(0, 1, -1, 0)    # down
        walk2(-1, 0, 0, -1)   # left

A217012 Permutation of natural numbers arising from applying the walk of a square spiral (e.g. A214526) to the data of right triangular type-3 spiral (defined in A214252).

Original entry on oeis.org

1, 8, 25, 9, 2, 3, 4, 5, 6, 7, 24, 50, 85, 51, 26, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 49, 84, 128, 181, 129, 86, 52, 27, 11, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 22, 48, 83, 127, 180, 242
Offset: 1

Views

Author

Alex Ratushnyak, Sep 23 2012

Keywords

Crossrefs

Programs

  • Python
    SIZE = 33       # must be 4k+1
    grid = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid[posY*SIZE+posX]=1
    n = 2
    def walk(stepX, stepY, chkX, chkY):
      global posX, posY, n
      while 1:
        posX+=stepX
        posY+=stepY
        grid[posY*SIZE+posX]=n
        n+=1
        if grid[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while posY!=0:
        walk( 1, 1, -1,  0)    # right-down
        walk(-1, 0,  0, -1)    # left
        walk(0, -1,  1,  1)    # up
    import sys
    grid2 = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid2[posY*SIZE+posX]=1
    def walk2(stepX, stepY, chkX, chkY):
      global posX, posY
      while 1:
        a = grid[posY*SIZE+posX]
        if a==0:
            sys.exit(1)
        print(a, end=', ')
        posX+=stepX
        posY+=stepY
        grid2[posY*SIZE+posX]=1
        if grid2[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while 1:
        walk2(0, -1, 1, 0)    # up
        walk2(1, 0, 0, 1)     # right
        walk2(0, 1, -1, 0)    # down
        walk2(-1, 0, 0, -1)   # left

A217013 Permutation of natural numbers arising from applying the walk of a square spiral (e.g. A214526) to the data of triangular horizontal-first spiral (defined in A214250).

Original entry on oeis.org

1, 3, 14, 4, 6, 7, 8, 2, 12, 30, 13, 32, 59, 33, 15, 5, 19, 20, 21, 22, 23, 9, 11, 29, 55, 89, 56, 31, 58, 93, 136, 94, 60, 34, 16, 18, 40, 41, 42, 43, 44, 45, 46, 24, 10, 28, 54, 88, 130, 180, 131, 90, 57, 92, 135, 186, 245, 187, 137, 95, 61, 35, 17, 39, 69
Offset: 1

Views

Author

Alex Ratushnyak, Sep 23 2012

Keywords

Crossrefs

Programs

  • Python
    SIZE = 33       # must be 4k+1
    grid = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid[posY*SIZE+posX]=1
    n = 2
    def walk(stepX, stepY, chkX, chkY):
      global posX, posY, n
      while 1:
        posX+=stepX
        posY+=stepY
        grid[posY*SIZE+posX]=n
        n+=1
        if grid[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while posX
    				

A217014 Permutation of natural numbers arising from applying the walk of a square spiral (e.g. A214526) to the data of triangular horizontal-last spiral (defined in A214226).

Original entry on oeis.org

1, 7, 22, 8, 2, 3, 4, 6, 20, 42, 21, 44, 75, 45, 23, 9, 11, 12, 13, 14, 15, 5, 19, 41, 71, 109, 72, 43, 74, 113, 160, 114, 76, 46, 24, 10, 28, 29, 30, 31, 32, 33, 34, 16, 18, 40, 70, 108, 154, 208, 155, 110, 73, 112, 159, 214
Offset: 1

Views

Author

Alex Ratushnyak, Sep 23 2012

Keywords

Crossrefs

Programs

  • Python
    SIZE = 33       # must be 4k+1
    grid = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid[posY*SIZE+posX]=1
    n = 2
    def walk(stepX, stepY, chkX, chkY):
      global posX, posY, n
      while 1:
        posX+=stepX
        posY+=stepY
        grid[posY*SIZE+posX]=n
        n+=1
        if grid[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while 1:
        walk(1,  1, -1,  0)    # down-right
        walk(-1, 0,  1, -1)    # left
        walk(-1, 0,  1, -1)    # left
        if posX<2:
            break
        walk(1, -1,  1,  1)    # up-right
    import sys
    grid2 = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid2[posY*SIZE+posX]=1
    def walk2(stepX, stepY, chkX, chkY):
      global posX, posY
      while 1:
        a = grid[posY*SIZE+posX]
        if a==0:
            sys.exit(1)
        print(a, end=', ')
        posX+=stepX
        posY+=stepY
        grid2[posY*SIZE+posX]=1
        if grid2[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while 1:
        walk2(0, -1, 1, 0)    # up
        walk2(1, 0, 0, 1)     # right
        walk2(0, 1, -1, 0)    # down
        walk2(-1, 0, 0, -1)   # left

A337838 Permutation of the natural numbers formed by numbering an infinite square grid by a counterclockwise triangular spiral and visiting them by a counterclockwise stair step spiral.

Original entry on oeis.org

1, 2, 13, 3, 14, 4, 5, 19, 20, 6, 7, 8, 24, 25, 9, 10, 12, 31, 60, 32, 61, 33, 62, 34, 63, 35, 15, 17, 18, 41, 42, 74, 75, 43, 44, 21, 22, 23, 48, 49, 83, 84, 50, 51, 26, 27, 11, 30, 59, 96, 143, 97, 144, 98, 145, 99, 146, 100, 147, 101, 148, 102, 64, 36, 16
Offset: 1

Views

Author

Mohammed Yaseen, Sep 25 2020

Keywords

Examples

			The path begins:
.
  16
.
  17  15  34
.
  18   4--14  33
       |   |
  19---5   3--13  32
   |           |       |
  20---6   1---2  12--31
       |           |
  21   7---8   9--10  11  30
           |   |
  22  23  24--25  26  27  28  29
.
		

Crossrefs

Same type of visit on other types of spirals: A334619, A337822.
Square spiral visit on the same spiral board: A217010.

A361207 An infinite 2d grid is filled with the positive integers by placing them clockwise around the lowest number with open neighbors. a(n) is then the n-th term when the grid is read as a clockwise square spiral.

Original entry on oeis.org

1, 2, 7, 3, 10, 4, 12, 5, 8, 16, 6, 15, 29, 17, 9, 20, 35, 21, 11, 23, 39, 24, 13, 18, 30, 46, 28, 14, 27, 45, 67, 47, 31, 19, 34, 53, 76, 54, 36, 22, 38, 58, 82, 59, 40, 25, 32, 48, 68, 92, 66, 44, 26, 43, 65, 91, 121, 93, 69, 49, 33, 52, 75, 102, 133, 103, 77
Offset: 1

Views

Author

John Tyler Rascoe, Mar 04 2023

Keywords

Comments

To begin, 1 is placed at square (x,y) = (0,0); this then becomes square s = 1. Integers are added sequentially to the open squares of the neighborhood around square s. The neighborhood of a square is defined as: east (x+1,y), south (x,y-1), west (x-1,y), and north (x,y+1). The order in which numbers may be added to a neighborhood is always east, south, west, then north.
Numbers are added to open squares in the neighborhood of square s following the given order. The next number added to the grid is always the smallest positive integer not yet present on the grid. If a filled square is encountered within the current square's neighborhood, the process moves to the next direction in the order. Once the process has cycled through all directions of the neighborhood of a given square s, the process is repeated at square s+1.
The filled grid is then read as a clockwise square spiral, oriented east starting at (0,0). a(n) is the n-th term along the square spiral.
Since each positive integer is added to the grid once, reading the grid as a spiral gives a permutation of the positive integers. Similar permutations can be created by expanding the neighborhood of s.

Examples

			The spiral begins:
.
                    41
.
                40  25  32
.
            39--24--13--18--30
.            |
        38  23  12---5-- 8--16  28
.            |   |           |
    37  22  11   4   1---2   6  14  26
.            |   |       |   |
        36  21  10---3---7  15  27
.            |               |
            35--20---9--17--29
.
                34  19  31
.
                    33
		

Crossrefs

Programs

  • Python
    # see linked program

A364130 An infinite 2d grid is filled with the positive integers by placing them clockwise in the narrow von Neumann's neighborhood of square s, the lowest number with open neighbors. a(n) is then the n-th term when the grid is read as a clockwise square spiral.

Original entry on oeis.org

1, 2, 8, 3, 15, 4, 22, 5, 10, 37, 6, 31, 32, 9, 12, 84, 85, 16, 18, 154, 155, 23, 26, 11, 38, 58, 57, 7, 50, 51, 52, 33, 64, 13, 96, 97, 98, 86, 17, 19, 172, 173, 174, 156, 24, 27, 73, 39, 59, 431, 430, 429, 43, 386, 387, 388, 389, 53, 34, 65, 14, 123, 124
Offset: 1

Views

Author

John Tyler Rascoe, Jul 09 2023

Keywords

Comments

This is a variant of A361207, where the size of a square's neighborhood is dependent on the value of that square rather than being of fixed size.
The neighborhood of square s is defined as the narrow von Neumann's neighborhood of radius s, see Zaitsev link. This consists of s squares in a straight line starting at square s, in each of the four directions east, south, west, and north.
To begin, 1 is placed at square (x,y) = (0,0); this then becomes square s = 1. Integers are then added sequentially to the open squares within the neighborhood of square s. The next number added to the grid is always the smallest positive integer not yet present on the grid.
Each direction of a square's neighborhood is first filled moving outwards before moving to the next direction. The order of cycling through the directions is always east, south, west, then north. Numbers are added to a given direction until either it is full, or a filled square is encountered. The process moves to the next direction regardless of any open squares remaining past the encountered filled square in that current direction of the neighborhood. Once the process has cycled through all directions of the neighborhood of a given square s, the process is repeated at square s+1.
The filled grid is then read as a clockwise square spiral, oriented east starting at (0,0). a(n) is the n-th term along the square spiral.

Examples

			For s = 2, the eastern and then southern directions are filled moving outward from s. Then in the western direction a filled square is encountered so the process moves on to the northern direction of 2's neighborhood.
For s = 3, starting in the eastern direction a filled square is immediately encountered. The process then moves to the southern direction even thought there are open squares remaining in the eastern direction of 3's neighborhood.
The spiral begins:
.
                    25
.
                    24
.
                    23      11
.
                    22---5--10
.                    |
    21  20  19  18   4   1---2   6   7
.                    |       |
            17  16  15---3---8
.
                        12   9
.
                        13
.
                        14
		

Crossrefs

Cf. A174344, A268038 (spiral coordinates).

Programs

  • Python
    # see linked program

A217291 Permutation of natural numbers arising from applying the walk of right triangular type-1 spiral (defined in A214230) to the data of square spiral (e.g. A214526).

Original entry on oeis.org

1, 2, 4, 16, 5, 6, 7, 8, 9, 10, 27, 11, 3, 15, 35, 63, 36, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 51, 84, 52, 28, 12, 14, 34, 62, 98, 142, 99, 64, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 83, 124, 173, 125, 85, 53, 29, 13, 33, 61, 97, 141, 193, 253
Offset: 1

Views

Author

Alex Ratushnyak, Sep 30 2012

Keywords

Crossrefs

Programs

  • Python
    SIZE = 29    # must be 4k+1
    grid = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid[posY*SIZE+posX]=1
    n = 2
    def walk(stepX, stepY, chkX, chkY):
      global posX, posY, n
      while 1:
        posX+=stepX
        posY+=stepY
        grid[posY*SIZE+posX]=n
        n+=1
        if grid[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while posX:
        walk(0, -1, 1, 0)    # up
        walk(1, 0, 0, 1)     # right
        walk(0, 1, -1, 0)    # down
        walk(-1, 0, 0, -1)   # left
    import sys
    grid2 = [0] * (SIZE*SIZE)
    posX = posY = SIZE//2
    grid2[posY*SIZE+posX]=1
    def walk2(stepX, stepY, chkX, chkY):
      global posX, posY
      while 1:
        a = grid[posY*SIZE+posX]
        if a==0:
            sys.exit(1)
        print(a, end=', ')
        posX+=stepX
        posY+=stepY
        grid2[posY*SIZE+posX]=1
        if grid2[(posY+chkY)*SIZE+posX+chkX]==0:
            return
    while 1:
        walk2(0, -1,  1,  1)    # up
        walk2( 1, 1, -1,  0)    # right-down
        if posX==SIZE-1:
            break
        walk2(-1, 0,  0, -1)    # left

A220102 Permutation of natural numbers arising from applying the walk of square spiral (e.g. A214526) to the data of double square spiral (defined in A220098).

Original entry on oeis.org

1, 2, 4, 6, 8, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 50, 52, 54, 56
Offset: 1

Views

Author

Alex Ratushnyak, Dec 04 2012

Keywords

Crossrefs

Programs

  • C
    #include 
    #define SIZE 20
    int grid[SIZE][SIZE];
    int direction[] = {0, -1,  1, 0, 0, 1, -1, 0};
    main() {
      int i, j, x1, y1, x2, y2, stepSize;
      int direction1pos=0, direction2pos=4, val;
      x1 = y1 = x2 = y2 = SIZE/2;
      for (val=grid[y1][x1]=1, stepSize=0; ; ++stepSize) {
        if (x1<1 || x1>=SIZE-1 || x2<1 || x2>=SIZE-1) break;
        if (y1<1 || y1>=SIZE-1 || y2<1 || y2>=SIZE-1) break;
        for (i=stepSize|1; i; ++val,--i) {
          x1 += direction[direction1pos  ];
          y1 += direction[direction1pos+1];
          x2 += direction[direction2pos  ];
          y2 += direction[direction2pos+1];
          grid[y1][x1] = val*2;
          grid[y2][x2] = val*2+1;
        }
        direction1pos = (direction1pos+2) & 7;
        direction2pos = (direction2pos+2) & 7;
      }
      direction1pos=0;
      x1 = y1 = SIZE/2;
      for (stepSize=2; ; ++stepSize) {
        for (i=stepSize/2; i; --i) {
          if (grid[y1][x1]==0) return;
          printf("%d, ",grid[y1][x1]);
          x1 += direction[direction1pos  ];
          y1 += direction[direction1pos+1];
        }
        direction1pos = (direction1pos+2) & 7;
      }
    }
Showing 1-10 of 10 results.