(-1)**1000

Ian Kelly ian.g.kelly at gmail.com
Wed Oct 22 10:23:50 EDT 2014


On Wed, Oct 22, 2014 at 5:02 AM, Peter Otten <__peter__ at web.de> wrote:
> 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.

Since the OP just wrote "parity", not "parity bit", I would assume
they meant as in http://en.wikipedia.org/wiki/Parity_(mathematics)



More information about the Python-list mailing list