You are viewing a single comment's thread. Return to all comments →
We know that A[x] = 1 ^ 2 ^ 3 ^ ... ^ x.
now, A[L] ^ A[L+1] ^ A[L+2] ^ ... ^ A[R] = A[1] ^ A[2] ^ ... A[L-1] ^ (A[L] ^ A[L+1] ^ ... ^ A[R]) ^ A[1] ^ A[2] ^ ... ^ A[L-1],
because a ^ b = b ^ a, a ^ a = 0, and 0 ^ a = a.
construct a function G(X) = A[1] ^ A[2] ^ ... ^ A[X].
the answer is G(R) ^ G(L-1). search the patern for G(X).
Seems like cookies are disabled on this browser, please enable them to open this website
Xor-sequence
You are viewing a single comment's thread. Return to all comments →
We know that A[x] = 1 ^ 2 ^ 3 ^ ... ^ x.
now, A[L] ^ A[L+1] ^ A[L+2] ^ ... ^ A[R] = A[1] ^ A[2] ^ ... A[L-1] ^ (A[L] ^ A[L+1] ^ ... ^ A[R]) ^ A[1] ^ A[2] ^ ... ^ A[L-1],
because a ^ b = b ^ a, a ^ a = 0, and 0 ^ a = a.
construct a function G(X) = A[1] ^ A[2] ^ ... ^ A[X].
the answer is G(R) ^ G(L-1). search the patern for G(X).