Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for N in range(1, 750):
- x = bin(N) [2:]
- ed = x.count("1")
- nol = x.count("0")
- if ed == nol:
- x = x + x[-1]
- elif ed > nol:
- x = x + "0"
- else:
- x = x + "1"
- ed = x.count("1")
- nol = x.count("0")
- if ed == nol:
- x = x + x[-1]
- elif ed > nol:
- x = x + "0"
- else:
- x = x + "1"
- ed = x.count("1")
- nol = x.count("0")
- if ed == nol:
- x = x + x[-1: ]
- elif ed > nol:
- x = x + "0"
- else:
- x = x + "1"
- k = int(x, 2)
- if k % 2 == 0 and k % 4 != 0:
- print(N)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement