seen = 0 \\ mask of values seen so far p = 0 \\ previous value unseen = 0 \\ least value not yet in the sequence W = 16 cats = 0 \\ mask of values < 2^W appearing in concatenation of previous terms pp = 0 \\ previous bits { for (n=0, 10 000, for (v=unseen, oo, if (p+v >= 2^W, break (2), \\ the end !bittest(seen, v) && !bittest(cats, p+v), seen += 2^v; while (bittest(seen, unseen), unseen++; ); print (n " " unseen); b = if (v, binary(v), [0]); for (k=1, #b, pp = (pp*2 + b[k]) % (2^W); for (w=1, W, cats = bitor(cats, 2^(pp % (2^w))); ); ); p = v; break ); ); ); } quit