nxt(v,R=4124) = {
	my (w=0, p=0, b=1);
	while (v || p,
		p = p\2 + (v%2)*8;
		if (bittest(R,p),
			w += b;
		);
		b *= 2;
		v \= 2;
	);
	if (w,
		w / 2^valuation(w,2),
		w
	);
}

v=1; for (n=0, 10 000, print (n " " h=hammingweight(v)); v=nxt(v));

quit