OFFSET
0,13
COMMENTS
A329116 gives x-coordinates for a point moving in counterclockwise triangular spiral.
LINKS
FORMULA
a(n) = floor(min(s*max(((0, 2*s) mod 2) - 2), (-2*s*s) mod (-1)) + ceiling(-s/2)) where s=sqrt(n).
EXAMPLE
y
|
4 | 56
| \
| \
| \
3 | 30 55
| / \ \
| / \ \
| / \ \
2 | 31 12 29 54
| / / \ \ \
| / / \ \ \
| / / \ \ \
1 | 32 13 2 11 28 53
| / / / \ \ \ \
| / / / \ \ \ \
| / / / \ \ \ \
0 | 33 14 3 0---1 10 27 52
| / / / \ \ \
| / / / \ \ \
| / / / \ \ \
-1 | 34 15 4---5---6---7---8---9 26 51
| / / \ \
| / / \ \
| / / \ \
-2 | 35 16--17--18--19--20--21--22--23--24--25 50
| / \
| / \
| / \
-3 | 36--37--38--39--40--41--42--43--44--45--46--47--48--49
|
+--------------------------------------------------------
x: -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
MATHEMATICA
a[n_] := Table[Floor[Min[#*Max[0, 2*Mod[#, 2] - 2], -2*#*Mod[#, -1]] + Ceiling[-#/2]] &[Sqrt@ k], {k, 0, n}]; a[64]
CROSSREFS
KEYWORD
sign,look
AUTHOR
Mikk Heidemaa, Nov 26 2019
STATUS
approved