login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A233399
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.
5
0, 0, -2, 0, -2, 3, -7, 3, -7, 10, 4, 10, 4, 23, -13, 23, -13, 42, 10, 42, 10, 71, 41, 71, 41, 108, 0, 108, 0, 151, 47, 151, 47, 204, 106, 204, 106, 265, 173, 265, 173, 194, 246, 194, 246, 115, 163, 115, 163, 26, 260, 26, 260, 127, 363, 127, 363, 20
OFFSET
0,3
EXAMPLE
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.
MATHEMATICA
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 *)
PROG
(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
(PARI) a(nMax)=concat(apply(z->[real(z), imag(z)], Turtle(primes(nMax))))
CROSSREFS
Sequence in context: A361651 A222753 A274568 * A226432 A072514 A071547
KEYWORD
sign,walk
AUTHOR
M. F. Hasler, Dec 08 2013
STATUS
approved