> A lapse of mind? >>>> n = 6 >>>> n & (-n) > 2 > > You probably meant n&1 or perhaps n%2. No, the exact right thing: 6 is binary 110 with the least significant bit beeing 10 thus the decimal value of 2. Albeit I have to admit that I didn't know the trick. -- Regards, Diez B. Roggisch