lua-users home
lua-l archive

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


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:

http://graphics.stanford.edu/~seander/bithacks.html#NextBitPermutation