• + 1 comment

    like zaber04 said, we need to set up an array starting from 0 to a certain number to see the pattern. The following is the code I use to set up the array and observe the pattern:

    result = 0
    further_xor = 0
    print(0, "\t", result)
    for i in range(1, 40):
      result = result ^ i
      further_xor = further_xor ^ result
    
      print(i, "\t", result, "\t", further_xor)