Advertisement
am1x

hz0001.py

Sep 25th, 2022
1,123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. for N in range(1, 750):
  2.  
  3.  x = bin(N) [2:]
  4.  
  5.  ed = x.count("1")
  6.  nol = x.count("0")
  7.  
  8.  if ed == nol:
  9.   x = x + x[-1]
  10.  elif ed > nol:
  11.   x = x + "0"
  12.  else:
  13.   x = x + "1"
  14.  
  15.  ed = x.count("1")
  16.  nol = x.count("0")
  17.  if ed == nol:
  18.   x = x + x[-1]
  19.  elif ed > nol:
  20.   x = x + "0"
  21.  else:
  22.   x = x + "1"
  23.  
  24.  ed = x.count("1")
  25.  nol = x.count("0")
  26.  if ed == nol:
  27.   x = x + x[-1: ]
  28.  elif ed > nol:
  29.   x = x + "0"
  30.  else:
  31.   x = x + "1"
  32.  k = int(x, 2)
  33.  if k % 2 == 0 and k % 4 != 0:
  34.   print(N)
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement