login
A336348
Square spiral of positive integers constructed by greedy algorithm, such that for any k > 0, k appears exactly k times, and all occurrences of k lie on the same row or on the same column.
1
1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 3, 8, 8, 8, 4, 9, 9, 9, 9, 5, 10, 10, 10, 10, 6, 11, 11, 11, 11, 11, 7, 12, 12, 12, 12, 12, 8, 4, 13, 13, 13, 13, 13, 9, 5, 14, 14, 14, 14, 14, 10, 6, 15, 15, 15, 15, 15, 15, 11, 7, 16, 16, 16, 16, 16, 16, 12
OFFSET
1,2
COMMENTS
This sequence can be seen as a two-dimensional variant of A002024.
For symmetry reasons, we obtain the same sequence when considering a clockwise or a counterclockwise square spiral, or when initially moving towards any unit direction.
LINKS
Rémy Sigrist, Colored representation of the spiral for -500 <= x <= 500 and -500 <= y <= 500 (where the hue is function of a(n) mod 4)
EXAMPLE
The spiral begins:
15--15--15--15--15--15---6--10--14
| |
11 11--11--11--11--11---6--10 14
| | | |
7 7 7---7---7---7---6 10 14
| | | | | |
16 12 3 3---3---2 6 10 14
| | | | | | | |
16 12 8 4 1---2 6 10 14
| | | | | | |
16 12 8 4---5---5---5 5 5
| | | | |
16 12 8---4---9---9---9---9 9
| | |
16 12---8---4--13--13--13--13--13
|
16--12---8--17--17--17--17--17--17
PROG
(PARI) See Links section.
CROSSREFS
Cf. A002024.
Sequence in context: A090616 A186704 A067434 * A177357 A320297 A165906
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Jul 19 2020
STATUS
approved