Cool Features of Consecutive XOR Operations
If you want to do the XOR operations for consecutive numbers, don't use 1^2^3^4^4^5.....^n
, it is too slow, and complexity O(n)
. The solution from the script runs in O(1)
There are cool properties.
Run:
xor(n)
Or if you want 98^99^100^101
,
Do :
xor(97)^xor(101)
And:
xor(m^n) = xor(m)^xor(n)