In this article, we would use ⊕ to represent the bitwise XOR operation between two integers. We observe that: for any x∈N, (4x)⊕(4x+1)⊕(4x+2)⊕(4x+3)=0, and therefore, ⨁i=04y−1i=0 for any y∈N+.
We now illustrate the formal proof of the above observation.
We firstly write x into a binary format, i.e.:
x=a0+2a1+22a2+⋯+2nan=(anan−1⋯a0)2,ai∈{0,1}
Let k=4x. Then:
k=22a0+23a1+⋯+2n+2an
k+1=1+22a0+23a1+⋯+2n+2an
k+2=2+22a0+23a1+⋯+2n+2an
k+3=1+2+22a0+23a1+⋯+2n+2an
Then the binary formats of k,k+1,k+2,k+3 are:
k=(anan−1⋯00)2
k+1=(anan−1⋯01)2
k+2=(anan−1⋯10)2
k+3=(anan−1⋯11)2
Since the (n+1) most significant bits of all aforementioned numbers are the same, the XOR sum of this part should be 0. For the latter bits, i.e., the 2 least significant bits, it is easy to compute that:
(00)⊕(01)⊕(10)⊕(11)=(00)
Therefore, k⊕(k+1)⊕(k+2)⊕(k+3)=0, and the proof is done.