Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def binaryAdditionChain(n):
- ans = [long(n)]
- while ans[-1] != 1:
- val = ans[-1]
- ans.append(val / 2)
- if val & 1:
- ans.append(val - ans[-1])
- return ans
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement