s = 0 unseen = 0 seen(v) = bittest(s, v) see(v) = s = bitor(s, 2^v); while (seen(unseen), unseen++) other(p) = { see(p); for (v=unseen, oo, if (!seen(v) && issquare(bitand(p, v)), return (v); ); ); } print (0 " " v=0); a = vector(2^13) u = 1 { for (n=1, oo, v = other(v); if (v<=#a, a[v] = n; while (a[u], print (u " " a[u]); if (u++>#a, break (2); ); ); ); ); } quit