\\ move forward alongside square spiral move(z) = { my (w=max(abs(real(z)), abs(imag(z)))); if (imag(z)==-w, z+1, real(z)==-w, z-I, imag(z)==+w, z-1, z+I); } { z=0; for (n=0, 10 000, print (n " " real(z)^2 + 2*imag(z)^2); z=move(z); ); } quit