numof 1 bits in 0 to 255 by 51b

template g(int n){static if(n)const g=n%2+g!(n/2);else const g=0;}template f(int n){static if(~n)const f=f!(n-1)~"012345678"[g!(n)..g!(n)+1];else const f="";}pragma(msg,f!(255));

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page