OFFSET
1,3
EXAMPLE
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;
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}]
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
George E. Laham II and Robert G. Wilson v, Aug 01 2018
STATUS
approved