3 ms·
Note that the combined xor of the first n integers can be computed in constant time (oeis.org/A003815). a(4n)=4n, (4n+1)=1, a(4n+2)=4n+3, a(4n+3)=0
by sarcarx 6y ago
Note that the combined xor of the first n integers can be computed in constant time (oeis.org/A003815).
a(4n)=4n, (4n+1)=1, a(4n+2)=4n+3, a(4n+3)=0