[Buffalo-pm] Re: [tpm] Bit Counting

Quantum Mechanic quantum_mechanic_1964 at yahoo.com
Wed Oct 1 12:51:08 CDT 2003


--- Mike Stok <mike at stok.co.uk> wrote:
> On Wed, 1 Oct 2003, Quantum Mechanic wrote:
> 
> > I'm looking for an elegant way to generate a list
> of
> > numbers whose binary representation has a given
> number
> > of 1's. I also want to generate this list in
> numerical
> > order.
> 
> If you know the number of bits in your upper limit
> and you know how many 
> of them have to be 1 then you can just generate the
> right bit strings 
> quite easily (and then filter those bigger than your
> limit)

Thanks, that's the next direction I'm going to
explore. I'm really just doing this as an adventure --
real work will have to wait!

-QM

=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quantum Mechanics: The dreams stuff is made of

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com



More information about the Buffalo-pm mailing list