%I #14 Mar 12 2015 18:58:25
%S 0,0,-2,0,-2,3,-7,3,-7,10,4,10,4,23,-13,23,-13,42,10,42,10,71,41,71,
%T 41,108,0,108,0,151,47,151,47,204,106,204,106,265,173,265,173,194,246,
%U 194,246,115,163,115,163,26,260,26,260,127,363,127,363,20
%N A "turtle transform" of the primes p=A000040: coordinates (x,y)=(a(2n),a(2n+1)) of a walk on the complex plane, where at step n the cursor turns by arg(i^p(n)), then moves p(n) units ahead.
%H M. F. Hasler, <a href="/A233399/a233399_2.png">Turtle(prime) walk after 25 steps</a>.
%H M. F. Hasler, <a href="/A233399/a233399_3.png">Turtle(prime) walk after 60 steps</a>.
%H M. F. Hasler, <a href="/A233399/a233399_4.png">Turtle(prime) walk after the 99th step, drawn in red</a>.
%e The cursor starts for n=0 at the origin (a(0)=a(1)=0), facing East (= direction of the x-axis). At step 1, prime(1)=2 leads to a turn left by 2*90 degrees (now facing West), then a step of two units into the new direction, to x+iy = -2, thus a(2)=-2, a(3)=0. Prime(2)=3 leads to a turn left by 3*90 degrees, now facing North, and a step of 3 units in that direction, to x+iy = -2+3i, therefore a(4)=-2, a(5)=3.
%t Turtle[v_] := Module[{p, L, d}, p=0; L={p}; d=1; For[i=1, i <= Length[v], i++, d *= I^v[[i]]; AppendTo[L, p += d*v[[i]] ] ]; L]; {Re[#], Im[#]}& /@ Turtle[Prime /@ Range[60]] // Flatten (* _Jean-François Alcover_, Dec 11 2013, translated from PARI *)
%o (PARI) Turtle(v,p=0,L=[p],d=1)=for(i=1,#v,d*=I^v[i];L=concat(L,p+=d*v[i]));L
%o (PARI) a(nMax)=concat(apply(z->[real(z),imag(z)],Turtle(primes(nMax))))
%K sign,walk
%O 0,3
%A _M. F. Hasler_, Dec 08 2013