top | item 44450233

(no title)

st0le | 8 months ago

Another fun trick I've discovered.

`XOR[0...n] = 0 ^ 1 .... ^ n = [n, 1, n + 1, 0][n % 4]`

discuss

order

nullc|8 months ago

Tables yuck :P, maybe

XOR[0...x] = (x&1^(x&2)>>1)+x*(~x&1)

bsdz|8 months ago

~Is there a simple proof for this type of identity?~

Actually I found something through Gemini based on the table mod 4 idea in previous post. Thanks.

tialaramex|8 months ago

Right, or in summary, no you don't need to all that extra work up front.