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) encode(p) = { my (t=p[1], x=p[2], y=p[3]); if (x<=0 || y>=x || t<0 || t>11, print ("#bug "t" "x" "y); quit; ); return (t+12*x+I*y); } \\ t = 0..11, 0 <= y < x neighbours(p) = { my (t=p[1], x=p[2], y=p[3]); my (n=[]); n = concat(n, [[t, x+1, y]]); if (y0, n = concat(n, [[t, x, y-1]]); ); if (y+11, n = concat(n, [[(t+1)%12, 2*x-1, 0], [(t+1)%12, 2*x+1, 0]]); ); ); return (n); } { print (0 " " 1); print (1 " " 6); g = vector(6, k, [2*k-1, 1, 0]); for (n=2, N=2500, print (n " " #g); if (n !seen(encode(p)), Set(concat(apply(neighbours, g)))); ); ); } quit