lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Fri, May 24, 2013 at 1:09 AM, Finn Wilcox <> wrote:
On 24/05/2013 06:29, Vaughan McAlley wrote:
> I’d like to iterate through all 40-bit binary numbers that have a
> Hamming weight of 25 (ie. 25 of the bits are set to 1).

I think this may be what you want:

See also (search for "snoob" around the end of 2-1) I don't know if the algorithm is any better, but the book explains some of the details.