%I #16 Jul 22 2020 07:50:56
%S 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,
%T 11,11,11,11,11,7,12,12,12,12,12,8,4,13,13,13,13,13,9,5,14,14,14,14,
%U 14,10,6,15,15,15,15,15,15,11,7,16,16,16,16,16,16,12
%N 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.
%C This sequence can be seen as a two-dimensional variant of A002024.
%C 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.
%H Rémy Sigrist, <a href="/A336348/b336348.txt">Table of n, a(n) for n = 1..10201</a>
%H Rémy Sigrist, <a href="/A336348/a336348.png">Colored representation of the spiral for -500 <= x <= 500 and -500 <= y <= 500</a> (where the hue is function of a(n))
%H Rémy Sigrist, <a href="/A336348/a336348_1.png">Colored representation of the spiral for -500 <= x <= 500 and -500 <= y <= 500</a> (where the hue is function of a(n) mod 4)
%H Rémy Sigrist, <a href="/A336348/a336348.gp.txt">PARI program for A336348</a>
%e The spiral begins:
%e 15--15--15--15--15--15---6--10--14
%e | |
%e 11 11--11--11--11--11---6--10 14
%e | | | |
%e 7 7 7---7---7---7---6 10 14
%e | | | | | |
%e 16 12 3 3---3---2 6 10 14
%e | | | | | | | |
%e 16 12 8 4 1---2 6 10 14
%e | | | | | | |
%e 16 12 8 4---5---5---5 5 5
%e | | | | |
%e 16 12 8---4---9---9---9---9 9
%e | | |
%e 16 12---8---4--13--13--13--13--13
%e |
%e 16--12---8--17--17--17--17--17--17
%o (PARI) See Links section.
%Y Cf. A002024.
%K nonn
%O 1,2
%A _Rémy Sigrist_, Jul 19 2020
|