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)