A359217 Y-coordinates of a point moving along a counterclockwise undulating spiral on a square grid.
0, 0, 1, 1, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2, -3, -3, -4, -4, -3, -3, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, -1, -1
Offset: 0
Examples
y ^ | 4 | 25--24 | | | 3 | 27--26 23--22 | | | 2 | 29--28 5---4 21--20 | | | | | 1 | 31--30 7---6 3---2 19--18 | | | | | 0 | 32--33 8---9 0---1 16--17 | | | | | -1 | 34--35 10--11 14--15 46--47 | | | | | -2 | 36--37 12--13 44--45 | | | -3 | 38--39 42--43 | | | -4 | 40--41 +------------------------------------> -4 -3 -2 -1 0 1 2 3 4 x
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..10081
- Hans G. Oberlack, Counterclockwise undulating spiral in a square grid
- Rémy Sigrist, PARI program
- Index entries for sequences related to coordinates of 2D curves
Programs
-
PARI
See Links section.
Formula
Conjecture: a(n) = T10 + T15 + T20 + T21 where
T1 = floor(n/16);
T2 = sqrt(2*T1 + 1/4);
T3 = floor(T2 - 1/2);
T4 = n - T3*(T3+1)*16/2;
T5 = (T3+1)*16;
T6 = T4 + (3/4)*T5 - 1;
T7 = T6/T5;
T8 = floor(T7);
T9 = 1 - T8;
T10 = T9 - floor(T4/2);
T11 = T4 + (2/4)*T5 - 1;
T12 = T11/T5;
T13 = floor(T12);
T14 = T8 - T13;
T15 = T14*floor((T5 - T11)/2);
T16 = T4 + (1/4)*T5 - 1;
T17 = T16/T5;
T18 = floor(T17);
T19 = T13 - T18;
T20 = -T19*floor((T4 - T5/2)/2);
T21 = -T18*floor((T5 - T4 + 1)/2).
a(2*n) = A180714(n). - Rémy Sigrist, Apr 01 2023
Comments