am1x icon

hz0001.py

am1x | PRO | 09/25/22 06:07:34 PM UTC | 0 ⭐ | 1707 👁️ | Never ⏰ | []
Python |

520 B

|

None

|

0 👍

/

0 👎

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)
 

Comments