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.

A317612 For k >= 1, fill a k X k square with the numbers 1 to k^2 by rows left to right and top to bottom; then read the square by a square clockwise spiral beginning at the top left and spiraling inwards.

Original entry on oeis.org

1, 1, 2, 4, 3, 1, 2, 3, 6, 9, 8, 7, 4, 5, 1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5, 6, 7, 11, 10, 1, 2, 3, 4, 5, 10, 15, 20, 25, 24, 23, 22, 21, 16, 11, 6, 7, 8, 9, 14, 19, 18, 17, 12, 13, 1, 2, 3, 4, 5, 6, 12, 18, 24, 30, 36, 35, 34, 33, 32, 31, 25, 19, 13, 7, 8, 9, 10, 11, 17, 23, 29, 28, 27, 26, 20, 14, 15, 16, 22, 21, 1, 2, 3, 4, 5, 6, 7, 14, 21, 28, 35, 42, 49, 48, 47, 46, 45, 44, 43
Offset: 1

Views

Author

George E. Laham II and Robert G. Wilson v, Aug 01 2018

Keywords

Comments

Inspired by A317186.
The final term in the k X k spiral is A031878(k+1).

Examples

			  1 => 1;
.
  1---2
      |
  3---4  =>  1, 2, 4, 3;
.
  1---2---3
          |
  4---5   6
  |       |
  7---8---9  =>  1, 2, 3, 6, 9, 8, 7, 4, 5;
.
   1---2---3---4
               |
   5---6---7   8
   |       |   |
   9  10--11  12
   |           |
  13--14--15--16
.
  => 1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5, 6, 7, 11, 10;
.
   1---2---3---4---5
                   |
   6---7---8---9  10
   |           |   |
  11  12--13  14  15
   |   |       |   |
  16  17--18--19  20
   |               |
  21--22--23--24--25
.
  => 1, 2, 3, 4, 5, 10, 15, 20, 25, 24, 23, 22, 21, 16, 11, 6, 7, 8, 9, 14, 19, 18, 17, 12, 13;
.
   1---2---3---4---5---6
                       |
   7---8---9--10--11  12
   |               |   |
  13  14--15--16  17  18
   |   |       |   |   |
  19  20  21--22  23  24
   |   |           |   |
  25  26--27--28--29  30
   |                   |
  31--32--33--34--35--36
.
  => 1, 2, 3, 4, 5, 6, 12, 18, 24, 30, 36, 35, 34, 33, 32, 31, 25, 19, 13, 7, 8, 9, 10, 11, 17, 23, 29, 28, 27, 26, 20, 14, 15, 16, 22, 21;
		

Crossrefs

Programs

  • Mathematica
    (* To form an n X n square table which begins left to right, then top to bottom *) a[i_, j_, n_] := j + n*(i - 1); f[n_] := Table[ a[i, j, n], {i, n}, {j, n}]