function y = f(n)
y = rem(floor((0:2^n-1).'*pow2(1-n:0)),2);
function combs = g(n)
combs = cell(1,n);
[combs{end:-1:1}] = ndgrid([0 1]);
combs = cat(n+1, combs{:});
combs = reshape(combs,[],n);
n = 20;
timeit(@()f(n))
timeit(@()getcondvects(n))
timeit(@()g(n))
ans =
1.5083
ans =
0.2946
ans =
0.3327