{
	for (n = 1, #a = vector(10 000),
		x = 2^0;
		for (w = 1, oo,
			if (n-2*w < 1,
					break,

					[u, v] = vecsort([a[n-2*w], a[n-w]]);
					d = v-u;

					\\ u v c
					c = v+d;
					x = bitor(x, 2^c);

					\\ c u v
					c = u-d;
					if (c > 0,
						x = bitor(x, 2^c);
					);

					\\ u c v
					c = (u+v)/2;
					if (type(c)==type(42),
						x = bitor(x, 2^c);
					);
			);
		);

		print (n " " a[n] = valuation(x+1, 2));
	);
}

quit