Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Bin(N):
- s = ''
- while N > 0:
- s = str(N) + s
- N = N // 2
- return s
- def antiBin(N):
- R = 0
- for i in range(len(N)):
- R += int(N[i])*2**(int(len(N))-i-1)
- return R
- def f(N):
- ns = Bin(N)
- N = Bin(N)
- N = list(N)
- a = len(N)
- N.append(N[a-1])
- if ns.count('1') % 2 == 0:
- N.append('0')
- elif ns.count('1') % 2 != 0:
- N.append('1')
- if N.count('1') % 2 != 0:
- N.append('1')
- R = antiBin(N)
- return R
- for i in range(1, 10000):
- if f(i) > 160:
- print(i)
- break
Add Comment
Please, Sign In to add comment