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-5 of 5 results.

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;
      }
    }

A332837 Squares visited by a knight moving on a double spiral numbered board and moving to the lowest available unvisited square at each step.

Original entry on oeis.org

1, 10, 5, 2, 8, 7, 4, 3, 9, 6, 12, 18, 33, 39, 20, 11, 32, 19, 13, 22, 28, 15, 21, 38, 61, 30, 17, 42, 25, 31, 16, 43, 24, 51, 76, 26, 45, 70, 37, 14, 29, 23, 40, 34, 57, 86, 49, 55, 84, 78, 53, 47, 72, 107, 41, 35, 56, 27, 44, 71, 36, 59, 88, 127, 80, 115
Offset: 1

Views

Author

Scott R. Shannon, Feb 26 2020

Keywords

Comments

This sequence uses a double spiral of numbers to enumerate the squares on the board. The knight starts on the square with number 1. At each step the knight goes to an unvisited square with the smallest number.
The sequence is finite. After 2958 steps the square with number 2796 is visited, after which all neighboring squares have been visited.
The lowest unvisited square during the walk is square number 2011.

Examples

			The squares are numbered using the double spiral numbering shown below:
.
  --48--46--44--42--40--38--36
                             |
    27--25--23--21--19--17  34
     |                   |   |
    29  10---8---6---4  15  32
     |   |           |   |   |
    31  12   3---1---2  13  30
     |   |   |           |   |
    33  14   5---7---9--11  28
     |   |                   |
    35  16--18--20--22--24--26
     |
    37--39--41--43--45--47--49--
		

Crossrefs

Cf. A220098, A316667, A329022, A332980 (quadruple spiral).

A332980 Squares visited by a knight moving on a quadruple spiral numbered board and moving to the lowest available unvisited square at each step.

Original entry on oeis.org

1, 10, 7, 2, 8, 3, 9, 4, 6, 5, 15, 12, 38, 11, 14, 21, 32, 20, 17, 28, 39, 13, 16, 19, 30, 18, 33, 44, 56, 37, 22, 34, 23, 35, 24, 36, 25, 52, 71, 29, 40, 59, 47, 66, 31, 42, 54, 77, 89, 27, 62, 43, 55, 74, 86, 117, 70, 51, 94, 67, 48, 60, 41, 26, 65, 92, 49
Offset: 1

Views

Author

Scott R. Shannon, Mar 04 2020

Keywords

Comments

This sequence uses a quadruple spiral of numbers to enumerate the squares on the board. The knight starts on the square with number 1. At each step the knight goes to an unvisited square with the smallest number.
The sequence is finite. After 1837 steps the square with number 1748 is visited, after which all neighboring squares have been visited.
The lowest unvisited square during the walk is square number 1211.

Examples

			The squares are numbered using the quadruple spiral numbering shown below:
                             |
  --49--45--41--37--33--29  48
                         |   |
    26--22--18--14--10  25  44
     |               |   |   |
    30  11---7---3   6  21  40
     |   |       |   |   |   |
    34  15   4-- 1---2  17  36
     |   |   |   |       |   |
    38  19   8   5---9--13  32
     |   |   |               |
    42  23  12--16--20--24--28
     |   |
    46  27--31--35--39--43--47--
     |
		

Crossrefs

Cf. A220098, A316667, A329022, A332837 (double spiral).

A220099 Sum of the eight nearest neighbors of n in a double spiral with positive integers and 1 at the center.

Original entry on oeis.org

44, 66, 63, 94, 91, 81, 80, 101, 100, 158, 154, 133, 131, 153, 151, 222, 218, 185, 183, 190, 186, 206, 202, 237, 235, 318, 314, 269, 267, 270, 266, 286, 282, 321, 319, 414, 410, 353, 351, 350, 346, 366, 362, 382, 378, 398, 394, 437, 435, 542, 538, 469, 467, 462, 458
Offset: 1

Views

Author

Alex Ratushnyak, Dec 04 2012

Keywords

Comments

Double spiral begins:
.
82---84---86---88---90---92---94---96---98
|
80 51---53---55---57---59---61---63---65
| | |
78 49 26---28---30---32---34---36 67
| | | | |
76 47 24 11---13---15---17 38 69
| | | | | | |
74 45 22 9 2----4 19 40 71
| | | | | | | | |
72 43 20 7 1 6 21 42 73
| | | | | | | | |
70 41 18 5----3 8 23 44 75
| | | | | | |
68 39 16---14---12---10 25 46 77
| | | | |
66 37---35---33---31---29---27 48 79
| | |
64---62---60---58---56---54---52---50 81
|
99---97---95---93---91---89---87---85---83

Crossrefs

A220100 Sum of the four nearest neighbors of n in a double spiral with positive integers and 1 at the center.

Original entry on oeis.org

18, 27, 26, 42, 42, 34, 35, 42, 42, 74, 74, 58, 58, 66, 66, 106, 106, 82, 82, 90, 90, 98, 98, 106, 106, 154, 154, 122, 122, 130, 130, 138, 138, 146, 146, 202, 202, 162, 162, 170, 170, 178, 178, 186, 186, 194, 194, 202, 202, 266, 266, 218, 218, 226, 226, 234, 234, 242
Offset: 1

Views

Author

Alex Ratushnyak, Dec 04 2012

Keywords

Comments

Double spiral begins:
.
82---84---86---88---90---92---94---96---98
|
80 51---53---55---57---59---61---63---65
| | |
78 49 26---28---30---32---34---36 67
| | | | |
76 47 24 11---13---15---17 38 69
| | | | | | |
74 45 22 9 2----4 19 40 71
| | | | | | | | |
72 43 20 7 1 6 21 42 73
| | | | | | | | |
70 41 18 5----3 8 23 44 75
| | | | | | |
68 39 16---14---12---10 25 46 77
| | | | |
66 37---35---33---31---29---27 48 79
| | |
64---62---60---58---56---54---52---50 81
|
99---97---95---93---91---89---87---85---83

Examples

			The four nearest neighbors of 8 are 3, 6, 23, 10; their sum is a(8)=42.
The four nearest neighbors of 9 are 22, 11, 2, 7; their sum is a(9)=42.
		

Crossrefs

Showing 1-5 of 5 results.