Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
short complex solution in Creative category for Square Spiral by DiZ
def find_distance(a,b):
def c(n):
r=int((-n)**.5)|1
return(r/2+r*.5j-n%r)*1j**(r+n//r)
d=c(1-a)-c(1-b)
return abs(d.real)+abs(d.imag)
Aug. 28, 2014