(-1)**1000

Peter Otten __peter__ at web.de
Wed Oct 22 07:02:09 EDT 2014


Michiel Overtoom wrote:

> 
> On Oct 22, 2014, at 12:29, Peter Otten wrote:
> 
>> That looks like log(a) while a parity check takes constant time:
>> $ python3 -m timeit -s 'a = 10**10' 'a & 1'
> 
> 
> Do you mean 'parity' as in http://en.wikipedia.org/wiki/Parity_bit ? 
> Because a parity bit denotes whether the *number* of '1' bits is even or
> odd, not the value of the least significant bit.

No, I meant the lsb. The OP introduced the term 'parity'; not sure if that 
was erroneous, too, or if there is an angle to the problem that escapes me.




More information about the Python-list mailing list