The XOR of all the numbers from to inclusive is
This problem is a part of Tessellate S.T.E.M.S (2019)
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
For brevity, I will write ⊕ for the bitwise XOR.
Note that for any natural k , ( 4 k ) ⊕ ( 4 k + 1 ) ⊕ ( 4 k + 2 ) ⊕ ( 4 k + 3 ) = 0 and that 1 0 1 0 0 and 1 0 1 0 0 0 are integral multiples of 4 , so n = 1 0 1 0 0 ⨁ 1 0 1 0 0 0 n = 1 0 1 0 0 0 ⊕ k = 4 1 0 1 0 0 ⨁ 4 1 0 1 0 0 0 − 1 ( ( 4 k ) ⊕ ( 4 k + 1 ) ⊕ ( 4 k + 2 ) ⊕ ( 4 k + 3 ) ) = 1 0 1 0 0 0 ⊕ k = 4 1 0 1 0 0 ⨁ 4 1 0 1 0 0 0 − 1 0 = 1 0 1 0 0 0