{ a = vector(10 001); u = 0; for (n=1, oo, x = 0; k = 0; for (v=u, #a-1, if (a[1+v]==0 && bitand(x,v)==0, a[1+v] = (n-1)*n/2 + k++; x += v; while (a[1+u], print (u " " a[1+u]); if (u++ == #a, break (3); ); ); if (k==n, break; ); ); ); ); } quit