Last active
November 5, 2017 19:03
-
-
Save benaryorg/439201eee9f562ca49ad6cdd17284e58 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
def xor_to(to,cur=0,acc=0): | |
cur+=1 | |
if cur > to: | |
return acc | |
acc^=cur | |
return xor_to(to,cur,acc) | |
if __name__ == '__main__': | |
print(xor_to(int(sys.argv[1]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment