allocate mem(2^30) tr(v)=if (v>=0, 1+2*v, -2*v) big = 100000 s = [] S = [] seen(z)=my (x=tr(real(z)),y=tr(imag(z)));if (max(x,y)>big, setsearch(S,z), x>#s, 0, bittest(s[x],y)) see(z)=my (x=tr(real(z)),y=tr(imag(z)));if (max(x,y)>big, S=setunion(S,Set(z)); return, x>#s, s=concat(s,vector(x-#s))); s[x]=bitor(s[x],2^y) neighbours(z) = { [ z + (-1)^imag(z), z + (1+I)*(-1)^(imag(z)+real(z)), z + I*(-1)^real(z) ] } { gen = [1+I]; for (n=0, M=2^13, print (n " " #gen); if (n !seen(z), Set(concat(apply (neighbours, gen)))); ); ); } quit