Skip to main content
1 of 2
Dennis
  • 211.7k
  • 41
  • 380
  • 830

Python 2, 72 bytes

n=s=1;x=[] exec'x+=[s]*n+[s*1j]*n;n+=1;s=-s;'*input() print sum(x[:n-1]) 

Indexing is 0-based, output is a complex number. Test it on Ideone.

Dennis
  • 211.7k
  • 41
  • 380
  • 830