cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A233399 #14 Mar 12 2015 18:58:25
%S A233399 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 A233399 41,108,0,108,0,151,47,151,47,204,106,204,106,265,173,265,173,194,246,
%U A233399 194,246,115,163,115,163,26,260,26,260,127,363,127,363,20
%N 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.
%H A233399 M. F. Hasler, <a href="/A233399/a233399_2.png">Turtle(prime) walk after 25 steps</a>.
%H A233399 M. F. Hasler, <a href="/A233399/a233399_3.png">Turtle(prime) walk after 60 steps</a>.
%H A233399 M. F. Hasler, <a href="/A233399/a233399_4.png">Turtle(prime) walk after the 99th step, drawn in red</a>.
%e A233399 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 A233399 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 A233399 (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 A233399 (PARI) a(nMax)=concat(apply(z->[real(z),imag(z)],Turtle(primes(nMax))))
%K A233399 sign,walk
%O A233399 0,3
%A A233399 _M. F. Hasler_, Dec 08 2013