\\ move alongside hexagonal spiral (z=x+I*y) move(z) = { my (x=real(z), y=imag(z)); if (x>=0 && x<=-y, return (z+1), x>0 && y>=0, return (z+I-1), -x0, return (z-1), y>0, return (z-I), x<0, return (z-I+1), return (z+I) ); quit; } is eisenstein prime(z) = { my (x=real(z)+imag(z), y=imag(z), p); if ((x==0 || y==0 || x==y) && (p=max(abs(x), abs(y)))%3==2 && isprime(p), return (1), ((p=x^2-x*y+y^2)%3==1 || p%3==0) && isprime(p), return (1), return (0); ); } { z=0; n=0; for (k=0, oo, if (z==0 || is eisenstein prime(z), print (n++ " " k); if (n==10 000, break; ); ); z=move(z); ); } quit