Skip to main content
3 of 5
added 78 characters in body
xnor
  • 146.6k
  • 26
  • 279
  • 652

Python, 46 bytes

f=lambda n:n and 1j**int((4*n-3)**.5-1)+f(n-1)

Dennis's answer suggested the idea of summing a list of complex numbers representing the unit steps. The question is how to find the number of quarter turns taken by step i.

[0, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7]

These are generated by int((4*k+1)**.5-1), and then converted to a direction unit vector via the complex exponent 1j**_.

xnor
  • 146.6k
  • 26
  • 279
  • 652