At 04:22 AM 6/3/00 +0000, Secret Squirrel wrote:
>
>Out of all possible N-bit numbers, how many have exactly M ones (M <= N) ?
>
>
>
>(Yes, I am ashamed that I can't remember combinatorial logic, and that
>
>I am too lazy to open a book, so spare me the BS.)
>
>
>
> N
>
>Is it ( ) / 2 ? [ (N * N-1 * ... * N-M+1) / 2 ]
>
> M
>
no, that fails for N=2, M=1.
as a matter of fact, start with M=1 (answer:N) and then M=N (answer:1) and
you should be able to reason it out from there. I'm too lazy to go get the
book too.