big = 1 000 000
s = 0
S = []
unseen = 0
seen(v) = if (v < big, bittest(s, v), setsearch(S, v))
see(v) = if (v < big, s = bitor(s, 2^v), S = setunion(S, [v])); while (seen(unseen), unseen++)

\\ least k unseen / v AND k = 0
cc = [0]
avoid(v) = {
	if (!seen(0),
		return (0);
	);
	my (b, c, nb=1);
	for (e=0, oo,
		if (!bittest(v,e),
			if (nb==#cc,
				cc=concat(cc, vector(#cc));
			);
			b=2^e;
			for (k=1, nb,
				c = cc[nb+k] = cc[k]+b;
				if (!seen(c),
					return (c);
				);
			);
			nb*=2;
		);
	);
}


{
	my (u = vector(141));
	my (v = vector(#u));
	my (m = -1);

	for (n = 1, #u,
		my (r = 0);
		for (k = 1, n,
			a = avoid(bitor(r, bitor(u[k], v[n+1-k])));
			see(a);

			r += a;
			u[k] += a;
			v[n+1-k] += a;

			print (m++ " " a);
		);
	);
}

quit