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) { for (n = 1, #a = vector(10 000), for (k = 1, n-2, slope = (a[n-1]-a[k])/(n-1-k); \\ slope encoded as a complex number z = numerator(slope) + I*denominator(slope); if (!seen(z), \\ new slope see(z); a[n]++; ); ); print (n " " a[n]); ); } quit